WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] Enable Yoast SEO in custom post type (5 posts)

  1. AMediaCompany
    Member
    Posted 1 year ago #

    Using WordPress SEO 1.2.8.7

    Problem: I've got a few custom post types, and most are working fine with Yoast SEO, which were build with the Custompress plugin. however, I've one post type which does NOT show up the Yoast SEO meta box, and this was manually created. The post types show up in the Yoast admin and I can set options for them, but the Meta box does not show up. Contrary to other posters, I can't enable this

    What I expect to happen:
    Documentation on how to enable/disable Yoast SEO on a particular custom post type. Forgive me if the admin shows how to do this. I can't see it. Am I missing a required post capability?

    Code used to register this post type:

    add_action('init', function() {
    
    	register_post_type( 'channelmain',
    		array(
    			'labels' => array(
    				'name' => __( 'Channel Main' ),
    				'singular_name' => __( 'Channel Main' ),
    				'parent_item_colon'=>''
    			),
    			'publicly_queryable' => true,
    			'exclude_from_search' => true,
    			'show_ui' => true,
    			'menu_position' => 23,
    			'supports' => array(
    				'title',
    				'thumbnail',
    				'excerpt',
    				'page-attributes',
    				/* trying to enable the wordpress Yoast SEO */
    				'custom_fields',
    				'revisions',
    				'post-formats'
    			),
    			'taxonomies' => array('category'),
    			'show_in_nav_menus' => false,
    			'rewrite' => array('pages' => false, 'slug'=>'channel'),
    
    			/* parent to whom possible */
    			'hierarchical'=>true,
    			'capability_type'=>'post',
    			'has_archive' => true
    		)
    	);
    
    });

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. AMediaCompany
    Member
    Posted 1 year ago #

    Okay, I've finally found the problem, and it may help some people in the other requests

    To remove Yoast SEO from a post type:
    Make sure your post type does not contain the following code in the register post type:

    'public' => true

    To Enable Yoast SEO in a post type:
    Make sure your post type does contain the following code in the register post type:

    'public' => true

  3. AMediaCompany
    Member
    Posted 1 year ago #

    marking as resolved

  4. Greg
    Member
    Posted 1 year ago #

    @AMediaCompany, thanks. That worked exactly as you described it.

  5. a2d
    Member
    Posted 11 months ago #

    Brilliant. Just the ticket to solve why the "Higher" theme from MegaThemes on Themeforest was not working with Yoast. Better support than the theme developer!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic