Title: Ignore Plugin on Certain Post Type
Last modified: January 28, 2019

---

# Ignore Plugin on Certain Post Type

 *  [schuerwm](https://wordpress.org/support/users/schuerwm/)
 * (@schuerwm)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/ignore-plugin-on-certain-post-type/)
 * The plugin is working great when i pass ?amp into pages. However, I’d like to
   have the plugin completely ignored and run custom amp code on certain post types.
   I’ve tried, but it just returns a 404.
 *     ```
       add_filter( 'amp_skip_post', 'isa_skip_posts', 10, 3 );
       function isa_skip_posts( $skip, $post_id, $post ) {
   
       	if (get_post_type() == "summary" ) {
               $skip = true;
           }
           return $skip;
       }
       ```
   
 * I want to run the following code to call a separate template to render for a 
   post type, but the ampforwp plugin is loading and rendering a 404 page (the 404
   loads in the ampforwp amp design). Ideally, just want the plugin to not run so
   my code below can execute.
 *     ```
       add_filter( 'template_include', 'amp_page_template', 99 );
   
       function amp_page_template( $template ) {
   
       	$the_slug = str_replace("?amp", "", $_SERVER["REQUEST_URI"]);
   
       	$args = array(
       	  'name'        => $the_slug,
       	  'numberposts' => 1,
       	  'post_type'	=> 'any'
       	);
   
       	$my_posts = get_posts($args);
   
       	if( $my_posts ) :
       		global $post;
       		$post = $my_posts[0];
       		setup_postdata( $post);
   
       		if (strpos($_SERVER['REQUEST_URI'],'?amp') !== false) {
   
       			if (get_post_type() == "summary" ) {
       				$template = get_template_directory() .  '/template-parts/amp/amp-master.php';
       			} 
   
       		}
       		endif;
       		wp_reset_postdata();	
       	return $template;
       }
       ```
   
 * Any help would be greatly appreciated.

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [ampforwp](https://wordpress.org/support/users/ampforwp/)
 * (@ampforwp)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/ignore-plugin-on-certain-post-type/#post-11147472)
 * Hi [@schuerwm](https://wordpress.org/support/users/schuerwm/),
 * Regarding the AMP on certain post types, You can exclude AMP from your preferred
   pages from the “Hide AMP Bulk Tool” section. Did you try these options? If not,
   please try these options to hide the AMP and show certain post types. You can
   find this option in AMP > Setting > Hide AMP Bulk Tool.
 * Regarding the custom template, Here are some steps to create the custom template:
 * * First create a folder called as ‘ampforwp’ in your child theme ( Screenshot:
   [http://take.ms/hHsDG](http://take.ms/hHsDG) ).
    * And in that folder, add the
   new file which you want to override example page.php (screenshot: [http://take.ms/pz0OF](http://take.ms/pz0OF)).
   make sure that swift theme’s file name and new file name should be same. * Copy
   all the code from the page.php of swift theme and paste it in the new file which
   we’ve named as page.php. * And add the extra code which you want to add.
 * You can also check this tutorial here: [https://ampforwp.com/tutorials/article/create-custom-template-post-type-taxonomy-amp-theme-framework/](https://ampforwp.com/tutorials/article/create-custom-template-post-type-taxonomy-amp-theme-framework/)
 * If still, didn’t solve the issue, please contact us directly on [team@magazine3.com](https://wordpress.org/support/topic/ignore-plugin-on-certain-post-type/team@magazine3.com?output_format=md).
   Our technical team will assist you there.
 * Hope it helps.

Viewing 1 replies (of 1 total)

The topic ‘Ignore Plugin on Certain Post Type’ is closed to new replies.

 * ![](https://ps.w.org/accelerated-mobile-pages/assets/icon-256x256.png?rev=1693616)
 * [AMP for WP - Accelerated Mobile Pages](https://wordpress.org/plugins/accelerated-mobile-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/accelerated-mobile-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/accelerated-mobile-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/accelerated-mobile-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/accelerated-mobile-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/accelerated-mobile-pages/reviews/)

## Tags

 * [ampforwp](https://wordpress.org/support/topic-tag/ampforwp/)

 * 1 reply
 * 2 participants
 * Last reply from: [ampforwp](https://wordpress.org/support/users/ampforwp/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/ignore-plugin-on-certain-post-type/#post-11147472)
 * Status: not resolved