WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years 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:
PR Number:

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)

#1 @toscho
6 years 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.

#2 @ericmann
6 years ago

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

#3 @helen
6 years ago

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