• Resolved aunpric

    (@aunpric)


    Hi I have a site but loading critical css for some pages are creating a little issue so how can stop loading critical css on those pages
    Their are only Three page

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Frank Goossens

    (@futtta)

    you can disable “inline & defer” using code like this;

    add_filter('autoptimize_filter_css_defer','no_inline');
    function no_inline() {
      if ( strpos( $_SERVER['REQUEST_URI'], 'test-image' ) !== false || is_front_page() ) {
    	return false;
      } else {
    	return true;
      }
    }

    which would disable “inline & defer” for a page that has “test-page” in the URL and for the front-page.

    hope this helps,
    frank

    Thread Starter aunpric

    (@aunpric)

    Hi Thanks for the reply
    My Three pages url is something like this
    https://example.com/my-posts/
    https://example.com/my-posts/?task=new
    https://example.com/your-profile/

    these three pages i want to exclude
    and thanks for the fast reply

    Plugin Author Frank Goossens

    (@futtta)

    in that case you’d need something like this @aunpric;

    add_filter('autoptimize_filter_css_defer','no_inline');
    function no_inline() {
      if ( strpos( $_SERVER['REQUEST_URI'], 'my-posts' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'your-profile' ) !== false ) {
    	return false;
      } else {
    	return true;
      }
    }
    Thread Starter aunpric

    (@aunpric)

    Thanks it works??

    But one problem it still showing Jquery as render blocking

    Plugin Author Frank Goossens

    (@futtta)

    well, you can always try removing js/jquery/jquery.js from AO’s JS optimization exclusions, but that might break stuff (theme and/ or plugin functionality) on your site, so do test thoroughly!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to not load critical css for some page’ is closed to new replies.