Make WordPress Core

Opened 19 years ago

Closed 18 years ago

#6558 closed defect (bug) (invalid)

Searching Posts or Pages only with post_type is broken

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

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
19 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
19 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
18 years ago

  • Milestone 2.5.2 → 2.9

Milestone 2.5.2 deleted

#4 @urbanor
18 years ago

  • Milestone 2.9 → 2.7

#5 @ryan
18 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
18 years ago

  • Milestone 2.7
  • Resolution → invalid
  • Status new → closed
Note: See TracTickets for help on using tickets.