WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9760 closed defect (bug) (invalid)

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

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

Description

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.

if(empty($_GETs?))

Surely this is a bug?

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

Change History (3)

comment:1 @hakre6 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.

comment:2 @Denis-de-Bernardy6 years ago

  • Milestone Unassigned deleted

comment:3 @hakre6 years ago

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