Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#9760 closed defect (bug) (invalid)

global $post->ID id of first search result in searches

Reported by: dbusby's profile d.busby Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7.1
Component: Plugins Keywords: reporter-feedback
Focuses: Cc:


I have written a plugin "aptus" soon to be released to the community, one of it's functions is a breadcrumb navigation generator.

Currently whenever a search is made, upon hitting the search results page the global $post->ID is populated with the ID of the first search result, this in turn goes on to populate the breadcrumb with content as if the user was currently on the first result page.

Currently I am using a work around.


Surely this is a bug?

Shouldn't in the case of searches the $post object return 0?

Change History (3)

#1 @hakre
15 years ago

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

the $post variable is populated on multiple points with different values. there is no strict rule at which point that variable must or must not have a certain value as you are trying to do for the search.

it might help you to checkout Conditional Tags documentation in codex to find some code that is checking for various requests (or queries) in wordpress.

i must say that is not a bug. please consider codex or the forums to get help with plugin evelopment.

#2 @Denis-de-Bernardy
15 years ago

  • Milestone Unassigned deleted

#3 @hakre
15 years ago

  • Keywords reporter-feedback added; $post post id search removed
Note: See TracTickets for help on using tickets.