1

I created a custom post type.

When I click "Add new" for this post type, I see among other meta boxes a "Main Slider Item SEO" meta box. This SEO is superfluous. Can I remove it?

add_action( 'init', 'create_post_type' );
function create_post_type() {
    register_post_type( 'main_slider_item',
        array(
            'labels' => array(
                                  'name' => __( 'Main Slider Items' ),
                                  'singular_name' => __( 'Main Slider Item' ),
                                  'menu_name' => __( 'Main Slider' )
                        ),
                        'description' => "A banner with a text and button",
                        'public' => true,
                        'exclude_from_search' => true,
                        'show_in_nav_menus' => false,
                        'map_meta_cap' => false,
                        'supports' => array('title', 'thumbnail'),
                        'has_archive' => false,
                        'show_in_nav_menus' => false,
        )
    );
}

I also want to remove editing layout for this custom post type.

In fact for this post type I am going to display only the excerpt on the mainpage and am not going ever to display the page of the post.

13
  • 2
    What are you using for SEO? This may be a part of whatever SEO plugin you're using, in which case you'd have to override that function to not display for this custom post type.
    – SickHippie
    Commented Mar 6, 2012 at 18:37
  • 2
    Then what are you using to manage your custom post types? SEO is not a part of standard WordPress - "SEO" only appears in two core files, both in comment lines.
    – SickHippie
    Commented Mar 6, 2012 at 19:03
  • 1
    Switch to Twenty Eleven Theme. Deactivate ALL Plugins. Then verify whether or not you still see this Custom Post Type. When you realize that it's no longer there, reactivate each Plugin one by one, until this Custom Post Type returns, in order to identify which Plugin is registering the CPT. If you've reactivated all Plugins, and the CPT still isn't there, switch back to your Theme. If the CPT appears, then you know that the Theme itself is registering the CPT. Then report back with the Plugin/Theme that is registering the CPT. Commented Mar 6, 2012 at 19:37
  • 1
    @porton - Yes, Trending theme does. It's in the file /library/admin/meta-box-post-seo.php. From the looks of it, it adds this meta box to all public post types. You can probably restrict it with a `if($post-type != 'my-custom-post-type') statement, if you don't mind hacking your theme. It might be easier to just ignore it or hide it with CSS, though.
    – SickHippie
    Commented Mar 6, 2012 at 19:39
  • 1
    @ChipBennett - it's in his theme, and it's not the CPT he's worried about, but the added SEO Meta Box added by his theme to all public post types, custom or otherwise.
    – SickHippie
    Commented Mar 6, 2012 at 19:40

1 Answer 1

0

I found a solution:

Set 'public' => false in register_post_type().

(After this I also need to set 'show_ui' => true to retain it in the admin interface.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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