Title: How exclude single post?
Last modified: February 16, 2021

---

# How exclude single post?

 *  Resolved [Vanderklompen](https://wordpress.org/support/users/junedvandersar/)
 * (@junedvandersar)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/how-exclude-single-post/)
 * How to exclude single post from autoptimize? My permalink is like this : [https://www.domain.com/2021/02/16/title-post.html](https://www.domain.com/2021/02/16/title-post.html)
   
   Any help please….

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/how-exclude-single-post/#post-14058571)
 * 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](https://wordpress.org/support/users/junedvandersar/)
 * (@junedvandersar)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/how-exclude-single-post/#post-14058677)
 * Im glad Thanks.. I need code snippet you mention above.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/how-exclude-single-post/#post-14058808)
 * 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](https://wordpress.org/support/users/junedvandersar/)
 * (@junedvandersar)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/how-exclude-single-post/#post-14058954)
 * 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](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/how-exclude-single-post/#post-14059009)
 * 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](https://wordpress.org/support/users/junedvandersar/)
 * (@junedvandersar)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/how-exclude-single-post/#post-14059131)
 * it seem working…. but maybe i have a little problem with the cache. anyway thanks
   for your time
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/how-exclude-single-post/#post-14059662)
 * you’re welcome, feel free to [leave a review of the plugin and support here](https://wordpress.org/support/plugin/autoptimize/reviews/#new-post)!
   🙂

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘How exclude single post?’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/how-exclude-single-post/#post-14059662)
 * Status: resolved