Title: Custom post types not supported?
Last modified: August 20, 2016

---

# Custom post types not supported?

 *  [biznit](https://wordpress.org/support/users/biznit/)
 * (@biznit)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/custom-post-types-not-supported/)
 * This plugin (WordPress SEO News from Yoast) doesn’t seem to recognize custom 
   post types, unless I’m doing something improperly.
 * It’s weird because on the Google News Sitemaps settings page, it lists all of
   our custom post types with tickboxes under the heading “Post Types to include
   in News Sitemap”, which would seem to indicate that it’s aware of custom post
   types and is set up to include them.
 * But only “posts” are included in the xml news sitemap, and on individual post
   pages, in the “WordPress SEO by Yoast” box, the “Google News” tab does not show
   up if it’s a custom post type.
 * I hope that makes sense, and thanks in advance for any responses.
 * [http://wordpress.org/extend/plugins/wordpress-seo-news/](http://wordpress.org/extend/plugins/wordpress-seo-news/)

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

 *  [ronaldblk](https://wordpress.org/support/users/ronaldblk/)
 * (@ronaldblk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/custom-post-types-not-supported/#post-3519738)
 * It does make sense, i’ve got the same issue. Sitemap is created but empty although
   I enabled custom post types
 *  [Sarah F](https://wordpress.org/support/users/gamingexamier/)
 * (@gamingexamier)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-post-types-not-supported/#post-3519749)
 * same with me, everything gets aded except for custom post types
 *  [bleggate](https://wordpress.org/support/users/bleggate/)
 * (@bleggate)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/custom-post-types-not-supported/#post-3519757)
 * Hi Guys check out this link where there is a solution that partially works for
   me but works for others. [https://github.com/jdevalk/Google-News-Sitemap/issues/20](https://github.com/jdevalk/Google-News-Sitemap/issues/20)
 * I think it depends on how your custom posts are set up? Open to your solution
   on how to make this work 100%
 *  [bleggate](https://wordpress.org/support/users/bleggate/)
 * (@bleggate)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/custom-post-types-not-supported/#post-3519759)
 * This code works on the Github page for me now. What you have to be sure of is
   to change the code on line 58
 * from
 * $post_types = “‘post'”;
 *  to
 * $post_types = “‘post’, ‘tribe_events'”;
 * with the name of your custom posts being in my case ‘tribe_events, the name has
   to be exactly what your custom posts are called.
 * I hope this helps.
 *  [bleggate](https://wordpress.org/support/users/bleggate/)
 * (@bleggate)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/custom-post-types-not-supported/#post-3519760)
 * Sorry an update on this, follow the `code changes below 🙂
 * Look for xml-news-metabox.php and replace entire file with the following code,
   I changed how script checks for posts that are checked in the settings and displays
   nothing if its not included.
 * —————-
 * <?php
 * /**
    * This code handles the display of the Google news tab in the WP SEO metabox.*/
   class WPSEO_XML_News_Sitemap_Metabox extends WPSEO_Metabox {
 *  /**
    * Options array */ private $options = array();
 *  /**
    * Class constructor */ public function __construct() { $this->options =
   get_option( ‘wpseo_news’ ); add_filter( ‘wpseo_save_metaboxes’, array( &$this,‘
   save_meta_boxes’ ), 10, 1 ); add_action( ‘wpseo_tab_header’, array( &$this, ‘
   tab_header’ ) ); add_action( ‘wpseo_tab_content’, array( &$this, ‘tab_content’));}
 *  /**
    * Ping Google about the update of this sitemap */ public function ping(){//
   Ping Google. Just do it. Not optional because if you don’t want to ping Google
   you don’t need no freaking news sitemap. wp_remote_get( ‘[http://www.google.com/webmasters/tools/ping?sitemap=&#8217](http://www.google.com/webmasters/tools/ping?sitemap=&#8217);.
   home_url( ‘news-sitemap.xml’ ) ); }
 *  /**
    * Make sure the parent class knows which meta_boxes content to save. * *
   [@param](https://wordpress.org/support/users/param/) array $mbs meta boxes that
   need to be saved. * [@return](https://wordpress.org/support/users/return/) array*/
   public function save_meta_boxes( $mbs ) { $mbs = array_merge( $mbs, $this->get_meta_boxes());
   return $mbs; }
 *  /**
    * Display the tab header in the WP SEO metabox */ public function tab_header(){
   global $post;
 *  if($this->options[‘newssitemap_include_’.$post->post_type] == “on”){
    echo ‘
   <li class=”news”><a href=”#wpseo_news”>’ . __( ‘Google News’ ) . ‘</a>’; } else{
   return false; } }
 *  /**
    * Create the content for the tab and return it to the parent class for 
   handling. * * [@return](https://wordpress.org/support/users/return/) string Contents
   of the tab */ public function tab_content() { global $post;
 *  if($this->options[‘newssitemap_include_’.$post->post_type] == “on”){
    $content
   = ”; foreach ( $this->get_meta_boxes() as $meta_box ) { $content .= $this->do_meta_box(
   $meta_box ); } $this->do_tab( ‘news’, __( ‘Google News’ ), $content ); } else{
   return false; } }
 *  /**
    * The metaboxes to display and save for the tab * * [@return](https://wordpress.org/support/users/return/)
   array $mbs */ public function get_meta_boxes() { $mbs = array(); $stdgenre = (
   isset( $this->options[‘newssitemap_default_genre’] ) ) ? $this->options[‘newssitemap_default_genre’]:‘
   blog’; $mbs[‘newssitemap-include’] = array( “name” => “newssitemap-include”, “
   type” => “checkbox”, “std” => “on”, “title” => __( “Include in News Sitemap” ));
   $mbs[‘newssitemap-keywords’] = array( “name” => “newssitemap-keywords”, “type”
   => “text”, “std” => “”, “title” => __( “Meta News Keywords” ), “description” 
   => __( “Comma separated list of the keywords this article aims at.”, “wordpress-
   seo” ), ); $mbs[‘newssitemap-genre’] = array( “name” => “newssitemap-genre”, “
   type” => “multiselect”, “std” => $stdgenre, “title” => __( “Google News Genre”,‘
   yoast-wpseo’ ), “description” => __( “Genre to show in Google News Sitemap.”,‘
   yoast-wpseo’ ), “options” => array( “none” => __( “None”, ‘yoast-wpseo’ ), “pressrelease”
   => __( “Press Release”, ‘yoast-wpseo’ ), “satire” => __( “Satire”, ‘yoast-wpseo’),“
   blog” => __( “Blog”, ‘yoast-wpseo’ ), “oped” => __( “Op-Ed”, ‘yoast-wpseo’ ),“
   opinion” => __( “Opinion”, ‘yoast-wpseo’ ), “usergenerated” => __( “User Generated”,‘
   yoast-wpseo’ ), ), ); $mbs[‘newssitemap-original’] = array( “name” => “newssitemap-
   original”, “std” => “”, “type” => “text”, “title” => __( “Original Source”, ‘
   yoast-wpseo’ ), “description” => __( ‘Is this article the original source of 
   this news? If not, please enter the URL of the original source here. If there
   are multiple sources, please separate them by a pipe symbol: | .’, ‘yoast-wpseo’),);
   $mbs[‘newssitemap-stocktickers’] = array( “name” => “newssitemap-stocktickers”,“
   std” => “”, “type” => “text”, “title” => __( “Stock Tickers”, ‘yoast-wpseo’ ),“
   description” => __( ‘A comma-separated list of up to 5 stock tickers of the companies,
   mutual funds, or other financial entities that are the main subject of the article.
   Each ticker must be prefixed by the name of its stock exchange, and must match
   its entry in Google Finance. For example, “NASDAQ:AMAT” (but not “NASD:AMAT”),
   or “BOM:500325” (but not “BOM:RIL”).’, ‘yoast-wpseo’ ), ); return $mbs; }
 * }
 * $wpseo_news_xml_metabox = new WPSEO_XML_News_Sitemap_Metabox();
 * ———————
    ` then change the following code in xml-news-sitemap-class.php line 
   58 from:
 * $post_types = “‘post'”;
 * to
 * $post_types = “‘post’, ‘tribe_events'”;
 * with the name of your custom posts being in my case ‘tribe_events, the name has
   to be exactly what your custom posts are called.
 * Thanks

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

The topic ‘Custom post types not supported?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wordpress-seo-news_cedbe8.svg)
 * [WordPress SEO News](https://wordpress.org/plugins/wordpress-seo-news/)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-seo-news/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-seo-news/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-seo-news/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-seo-news/reviews/)

 * 5 replies
 * 4 participants
 * Last reply from: [bleggate](https://wordpress.org/support/users/bleggate/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/custom-post-types-not-supported/#post-3519760)
 * Status: not resolved