• Hi,

    Thanks for your work on this plugin, it’s been working mostly fine for me but for some reason the yoast_* fields are not coming through in my custom post types, it does work fine for pages and regular posts.

    Here’s how I’ve registered it in case it helps:

    function portfolio_post_type() {
    	$labels = [
    		'name'                  => 'Portfolio Items',
    		'singular_name'         => 'Portfolio Item',
    		'menu_name'             => 'Portfolio',
    		'name_admin_bar'        => 'Portfolio',
    		'archives'              => 'Item Archives',
    		'attributes'            => 'Item Attributes',
    		'parent_item_colon'     => 'Parent Item:',
    		'all_items'             => 'All Items',
    		'add_new_item'          => 'Add New Item',
    		'add_new'               => 'Add New',
    		'new_item'              => 'New Item',
    		'edit_item'             => 'Edit Item',
    		'update_item'           => 'Update Item',
    		'view_item'             => 'View Item',
    		'view_items'            => 'View Items',
    		'search_items'          => 'Search Item',
    		'not_found'             => 'Not found',
    		'not_found_in_trash'    => 'Not found in Trash',
    		'featured_image'        => 'Featured Image',
    		'set_featured_image'    => 'Set featured image',
    		'remove_featured_image' => 'Remove featured image',
    		'use_featured_image'    => 'Use as featured image',
    		'insert_into_item'      => 'Insert into item',
    		'uploaded_to_this_item' => 'Uploaded to this item',
    		'items_list'            => 'Items list',
    		'items_list_navigation' => 'Items list navigation',
    		'filter_items_list'     => 'Filter items list',
    	];
    	$args = [
    		'label'                 => 'Portfolio Item',
    		'labels'                => $labels,
    		'supports'              => array( 'title', 'editor', 'excerpt', 'thumbnail' ),
    		'hierarchical'          => false,
    		'public'                => true,
    		'show_ui'               => true,
    		'show_in_menu'          => true,
    		'menu_position'         => 5,
    		'menu_icon'             => 'dashicons-portfolio',
    		'show_in_admin_bar'     => true,
    		'show_in_nav_menus'     => true,
    		'can_export'            => true,
    		'has_archive'           => true,
    		'exclude_from_search'   => false,
    		'publicly_queryable'    => true,
    		'capability_type'       => 'post',
    		'show_in_rest'          => true,
    	];
    
    	register_post_type( 'portfolio', $args );
    }
    add_action( 'init', 'portfolio_post_type' );

    I’m using WP 5.3.1 and the plugin version 2019.5.3, can you advise what to do?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Richard Korthuis

    (@rockfire)

    Hi @vengisss

    Thank you for using our plugin!

    After having a quick look at your code, I don’t see anything wrong with it. Could you try and give your add_action a different priority? Could you change that line to for instance:
    add_action( 'init', 'portfolio_post_type', 9 );

    If this works, please let us know, because that would mean we have to change the priority of our hooks (you should be able to use the default priority).

    Thread Starter Javier Villanueva

    (@vengisss)

    Thanks for the suggestion, lowering the priority worked.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not working for custom post type’ is closed to new replies.