Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#55155 closed defect (bug) (duplicate)

Cannot restrict search requests to page post type only

Reported by: bcworkz's profile bcworkz Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.9
Component: Posts, Post Types Keywords: needs-patch
Focuses: Cc:

Description

Requesting example.com/?s=foo&post_type=page returns all post types with "foo", not pages only. In parsing the query, the "post_type" query var gets dropped. Possibly because get_post_types( array(), 'objects' )['page']->publicly_queryable) returns false? This came up in the support forums.

Curiously, is_post_type_viewable('page') does return true as expected, even though it's supposedly relying upon the same publicly_queryable property.

Props @ksvgn2018 for bringing this to our attention.

Change History (1)

#1 @SergeyBiryukov
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, welcome back to WordPress Trac!

Thanks for the report, we're already tracking this issue in #18513.

Note: See TracTickets for help on using tickets.