WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a post type registered with this code, however 'exclude_from_search' => true seems to have no effect as I still find output in the search page. Am I making some mistake?

add_action('init', 'abundant_life_slides_register');
function abundant_life_slides_register() {
    $args = array(
        'label' => 'Slides',
        'description' => '',
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'show_in_nav_menus' => true,
        'has_archive' => false,
        'capability_type' => 'post',
        'hierarchical' => false,
        'rewrite' => array('slug' => 'slides'),
        'query_var' => true,
        'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),
        'labels' => array (
        'name' => 'Slides',
        'singular_name' => 'Slide',
        'menu_name' => 'Slides',
        'add_new' => 'Add Slide',
        'add_new_item' => 'Add New Slide',
        'edit' => 'Edit',
        'edit_item' => 'Edit Slide',
        'new_item' => 'New Slide',
        'view' => 'View Slide',
        'view_item' => 'View Slide',
        'search_items' => 'Search Slides',
        'not_found' => 'No Slides Found',
        'not_found_in_trash' => 'No Slides Found in Trash',
        'parent' => 'Parent Slide',
        'exclude_from_search' => true,

register_post_type('slides', $args);
share|improve this question
up vote 2 down vote accepted

Your exclude_from_search is currently inside your nested labels array. You need to move it up.

share|improve this answer
aargh ;-( .... thanks! Well spotted! – byronyasgur Feb 21 '13 at 23:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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