Make WordPress Core

Opened 12 months ago

Closed 12 months ago

Last modified 12 months ago

#24811 closed defect (bug) (invalid)

get_post_type returns attachment as a searchable post type

Reported by: unknowndomain Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.2
Component: Posts, Post Types Keywords:
Focuses: Cc:


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)

comment:1 toscho12 months ago

  • Cc info@… added
  • Keywords close added

The post type attachment is not registered with 'exclude_from_search' => false, and it can be used in search results too. So this is the correct behavior.

comment:2 ericmann12 months ago

  • Resolution set to invalid
  • Status changed from new to closed

comment:3 helen12 months ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.