• How can I disable Autoptimize for certain pages?
    This code not help for me:

    add_filter('autoptimize_filter_noptimize','noptimize_quiz',10,0);
    function noptimize_quiz() {
    	if (strpos($_SERVER['REQUEST_URI'],'uk')!== false) {
    		return true;
    	} else {
    		return false;
    	}
    }

    The page I need help with: [log in to see the link]

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

    (@optimizingmatters)

    Make sure you’re using the latest version (2.9.0), and
    1. enable the “Enable configuration per post/ page?” option on the main settings page
    2. edit the page for which you need AO not to optimize to find the Autoptimize settings for it (you can then disable AO entirely or just a part of the functionality).

    hope this helps,
    frank

    Thread Starter redstyle

    (@redstyle)

    I have about 4000 pages. Is it possible to do this with a hook?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ah, in that case the code posted above _should_ work (assuming you need all pages under uk/ not to be optimized). how/ where did you add the code snippet? did you clear any page cache(s) you might have?

    Thread Starter redstyle

    (@redstyle)

    This code i inserted in functions.php

    add_filter('autoptimize_filter_noptimize','noptimize_quiz',10,0);
    function noptimize_quiz() {
    	if (strpos($_SERVER['REQUEST_URI'],'uk')!== false) {
    		return true;
    	} else {
    		return false;
    	}
    }

    And clear all caches, but u can see its not help for me.

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

    (@optimizingmatters)

    no idea I’m afraid redstyle; the code looks OK, it _should_ work but clearly does not .. also strange that ?ao_noptimize=1 (which disables AO for the request) does not work either?

    Thread Starter redstyle

    (@redstyle)

    That’s right, it also doesn’t work, plugin version 2.9

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    no idea I’m afraid redstyle, this works fine on my end .. a conflict of some kind? :-/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Disable Autoptimize for certain pages’ is closed to new replies.