Opened 10 years ago
Closed 7 years ago
#38703 closed enhancement (worksforme)
parse_search() before pre_get_posts hook
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Query | Keywords: | |
| Focuses: | Cc: |
Description
When hooking pre_get_posts(), $query->get('s') may be of interest (in order, eg, to change some meta condition).
But it's currently not possible because this query_vars is initialized far later in the get_posts() workflow (by parse_search()).
Is there anything which keeps core from doing parse_search() earlier?
If not, could we provide query_vars['s'] to implementers of pre_get_posts?
Change History (1)
Note: See
TracTickets for help on using
tickets.
Hi @drzraf,
Sorry that it took so long for someone to respond to this ticket.
I just did some testing and when hooking into
pre_get_posts, I see the value searched for at thesindex in thequeryandquery_varsarrays. It's possible that a different ticket addressed this. I was unable to find one, though.I am going to close this out as
worksforme. But, if you are still having issues with the search value not being included when hookingpre_get_posts, feel free to reopen and provide more details to reproduce.