Make WordPress Core

Opened 16 years ago

Closed 15 years ago

#6558 closed defect (bug) (invalid)

Searching Posts or Pages only with post_type is broken

Reported by: urbanor's profile urbanor Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: General Keywords: post_type, search posts
Focuses: Cc:

Description

As of version 2.5, Wordpress searches posts and pages by default. To search posts only, I was recommended to use a hidden field named "post_type" with a value of "post". I can confirm this does indeed *not* work. The variable "post_type" seems to be getting cleared at some point in the application. I've verified this through tests on a couple clean installs of version 2.5.

Change History (6)

#1 follow-up: @mtekk
16 years ago

I played around with this and found that something like: http://site/?post_type=post&?s=foo will work when searching for foo, it will only search posts, if they are the other way around it does not work (posts and pages are included in the search results). So I think that hidden field needs to come before the normal text entry field.

#2 in reply to: ↑ 1 @mtekk
16 years ago

After further investigation, I retract my previous statement, as reported it is completely broken. I just didn't notice it gave me the front page again (made several test posts for things that happened to contain the search term, assumes everything was working).

#3 @ryan
16 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

#4 @urbanor
16 years ago

  • Milestone changed from 2.9 to 2.7

#5 @ryan
16 years ago

post_type is not a public query var. It is ignored if passed via URL. Only plugins and WP internals can use it.

#6 @ryan
15 years ago

  • Milestone 2.7 deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.