[wp-trac] [WordPress Trac] #20234: 'exclude_from_search' parameter for custom posts makes taxonomy archive pages return 0 posts

WordPress Trac wp-trac at lists.automattic.com
Wed Mar 14 12:54:55 UTC 2012


#20234: 'exclude_from_search' parameter for custom posts makes taxonomy archive
pages return 0 posts
--------------------------+-----------------------------
 Reporter:  egorpromo     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Post Types    |    Version:  3.3.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 I have custom posts 'manuals' and taxonomy 'manuals-category' for it.
 {{{
 add_action( 'init', 'create_manual_post_type' );
 function create_manual_post_type()
 {
         register_post_type('manual',
                 array(
                         'label' => 'Manuals',
                         'public' => TRUE,
                         'rewrite' => array( 'slug' => 'manuals',
 'with_front' => true),
                         'has_archive' => true,
                         'public' => true,
                         'exclude_from_search' => TRUE, //This is for
 exclude my manuals when I make search for word 'wordpress' like
 "http://myblog.com/?s=wordpress&submit=submit"
                 )
         );

         register_taxonomy(
 'manuals-category',
 'manual',
                 array(
                         'hierarchical'=>false,
                         'label'=>'Manual Category',
                         'rewrite' => array( 'slug' => 'manuals-category',
 'with_front' => true)
                         )
 );

         flush_rewrite_rules(false);

 }
 }}}
 I want use 'exclude_from_search' parameter to prevent custom posts are
 visible when somebody searches keywords in my blog.
 If I state 'exclude_from_search'=>TRUE my custom posts disappear on pages
 like  http://myblog.com/manuals-category/{slug}.
 {slug} is a term of 'manuals-category' taxonomy. Archive page opens but
 there are no posts in the Loop. When I state 'exclude_from_search'=>FALSE
 all is correct.

 I suppose it is not documented behavior
 [http://codex.wordpress.org/Function_Reference/register_post_type] and
 bug.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20234>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list