Opened 14 years ago
Closed 14 years ago
#20234 closed defect (bug) (duplicate)
'exclude_from_search' parameter for custom posts makes taxonomy archive pages return 0 posts
| Reported by: | egorpromo | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Posts, Post Types | Version: | 3.3.1 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
#17592