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

    (@optimizingmatters)

    easiest; add <!-- noptimize-page --> (exactly like that) to the post HTML view.

    alternatively I can provide a code snippet to exclude with a couple of lines of code, just say the word ??

    Thread Starter Vanderklompen

    (@junedvandersar)

    Im glad Thanks.. I need code snippet you mention above.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, here’s your personalized example ??

    add_filter('autoptimize_filter_noptimize','vanderklompen_ao_noptimize',10,1);
    function vanderklompen_ao_noptimize( $flag_in ) {
    	if ( strpos( $_SERVER['REQUEST_URI'], '2021/02/16/title-post.html' ) !== false ) {
    		return true;
    	} else {
    		return $flag_in;
    	}
    }
    Thread Starter Vanderklompen

    (@junedvandersar)

    hi. is that code exclude all my single post from autoptimize? as you know all my post has “.html” at the end of the slug.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ah, no, that snippet excluded specifically 2021/02/16/title-post.html ??

    the following excludes all posts;

    add_filter('autoptimize_filter_noptimize','vanderklompen_ao_noptimize',10,1);
    function vanderklompen_ao_noptimize( $flag_in ) {
    	if ( is_single() ) {
    		return true;
    	} else {
    		return $flag_in;
    	}
    }
    Thread Starter Vanderklompen

    (@junedvandersar)

    it seem working…. but maybe i have a little problem with the cache. anyway thanks for your time

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome, feel free to leave a review of the plugin and support here! ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How exclude single post?’ is closed to new replies.