• Resolved graphettion

    (@graphettion)


    Hello Frank,

    Hope you’re doing well! I was wanting to know if I could deregister the AO CSS on one page.

    Like:

    if ( is_page('/') ) {
      wp_deregister_style('whatever_ao_css_style_is');
    }

    Thank you,

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

    (@futtta)

    AO JS/ CSS is not registered/ enqueued, so that would not work. also simply removing AO’d CSS would leave that page without any CSS (as AO removes the links to the original CSS before injecting the optimized one). So I *guess* you’re rather looking for a way to disable CSS optimizing on a specific page (your frontpage)? In that case you can use a code snippet like this one;

    add_filter('autoptimize_filter_css_noptimize','no_css_ao_on_home');
    function no_css_ao_on_home() {
      if (is_front_page()) {
    	return true;
      } 
    }

    hope this helps,
    frank

    Thread Starter graphettion

    (@graphettion)

    Yeah, that worked! I was hoping to disable the styles on the homepage and just inline them so it would load faster, but that wouldn’t work cause it would add that to every page. I’ll prolly just end up doing critical css. Thanks again Frank. You’re awesome.

    Plugin Author Frank Goossens

    (@futtta)

    happy it worked, have a nice weekend ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove AO CSS from A Single Page’ is closed to new replies.