#24811 closed defect (bug) (invalid)
get_post_type returns attachment as a searchable post type
| Reported by: | unknowndomain | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Posts, Post Types | Version: | 3.5.2 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
I don't think get_post_type() should return the attachment post type as a searchable post type, because it doesn't show up in the search results.
In other words, this code snippet returns post and attachment and I think this is wrong...
$post_types = get_post_types( array( 'public' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'show_ui' => true, 'hierarchical' => false ) );
Change History (3)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
The post type
attachmentis not registered with'exclude_from_search' => false, and it can be used in search results too. So this is the correct behavior.