• Resolved omusman

    (@omusman)


    Hello,

    Can we disable CSS inline and defer for just logged-in users, just this single feature, i know theres an option to disable autoptimize for logged in user. But i still want the HTML and JAVA optimized.

    Regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    sure, with a couple of lines of PHP hooking into AO’s API using the autoptimize_filter_css_defer filter ??

    hope this helps,
    frank

    Thread Starter omusman

    (@omusman)

    In reference if someone need it, this includes all logged in users admins, editors all of them:

    add_filter('autoptimize_filter_css_defer','really_bail_loggedin',10,0);
    function really_bail_loggedin() {
    	if ( ! is_user_logged_in() ) {
    		return true;
    	} else {
    		return false;
    	}
    }

    Thanks Frank;

    • This reply was modified 3 years, 5 months ago by omusman.
    • This reply was modified 3 years, 5 months ago by omusman.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    great job Omusman! ??

    Now this was stupid of me, because while looking at the code I realize that in Settings -> Autoptimize -> Critical CSS -> Advanced Settings there is … “Add CCSS for logged in users?”, unticking that would do the same as your code snippet …

    Sorry for forcing you write code when it wasn’t really needed omusman ??

    frank

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable CSS Inline & Defer’ is closed to new replies.