How can I have post types shown on Page Attributes? For instance I have a custom post type which is product, and I want show it on Page Attributes alongside with the existing WP post types: page, post.

So I want so have a dropdown options and the user can switch around these post types:


My code in functions.php:

function product_init() {
    $args = array(
        'labels' => array(
            'name' => __('Products'),
            'singular_name' => __('Product'),
            'all_items' => 'All Products'
        'public' => true,
        'show_ui' => true,
        'capability_type' => 'page',
        'hierarchical' => true,
        // 'rewrite' => array('slug' => 'Products'),
        'query_var' => true,
        'menu_icon' => 'dashicons-star-filled',
        'supports' => array(
            // 'excerpt',
            // 'trackbacks',
    register_post_type( 'product', $args );
add_action( 'init', 'product_init' );

Any ideas?

  • so you need a drop down like Page Attributes -> Template for custom post type?
    – DHL17
    Mar 12 '18 at 10:38
  • @DHL17 see my answer below.
    – Run
    Mar 12 '18 at 10:42

A quick answer - post-type-switcher plugin below:


Though it would be great without a plugin.

  • 1
    There is nothing wrong with using a plugin for that.
    – swissspidy
    Mar 12 '18 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.