Opened 4 years ago
Last modified 13 months ago
#52742 new defect (bug)
Searching injects a page ID into the loop if search term matches a page slug
Reported by: | marcc1213 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.6.2 |
Component: | General | Keywords: | close |
Focuses: | Cc: |
Description
Create a page or post with a slug called "test".
Search for "test" using search form. Query string should be ?s=testing
The search page (search.php) will use that page ID in any functions calling "get_the_ID()". Calling get_the_ID() on search.php returns the ID of the page created above.
Note: See
TracTickets for help on using
tickets.
Hey @marcc1213,
First, my apologies that this took a such a long time to receive a response.
On to the issue itself. Are you still able to reproduce this? Could you provide some example code? The search page is not an actual page. Instead, it's more like an archive page, or any other psuedo page that lists multiple posts.
It is expected behavior that functions intended for use with a loop to return the corresponding values for the first post in a result set outside of/prior to the loop.
Going to mark this one with a
close
suggestion since this seems like expected behavior to me. I'll leave it open for a few weeks in case there is more to this report and the more details can be provided.