Opened 11 years ago
Closed 11 years ago
#2355 closed defect (bug) (invalid)
Add parameter for the search query
Reported by: | grosbouff | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.3.2 |
Component: | Component - Search | Keywords: | has-patch |
Cc: | pippin@… |
Description
It is globally possible to know, in Wordpress, if a query is a search ($query->is_search).
But it is not possible to know if a query is a bbPress search : the bbp_is_search() function returns true if we are on a search page; not if we are within a bbPress search query.
So when hooking functions on actions / filters related to queries, bbp_is_search() will return true even if the query is not the query dedicated to the selection of the searched forums/topics/replies.
There is a workaround for this :
function identify_bbpress_search_query($args){ $args['is_bbp_search']=true; return $args; } add_filter('bbp_before_has_search_results_parse_args','identify_bbpress_search_query');
But it would be quite logical to add it in the core, inside the default args of bbp_has_search_results().
Change History (3)
#3
@
11 years ago
- Milestone 2.5 deleted
- Resolution set to invalid
- Status changed from new to closed
You could look for either bbp_is_search
and bbp_search_terms
if you're looking for the results page. These are assigned in bbp_parse_query()
.
Marking as invalid. Reopen if this doesn't help, or doesn't work how you expect.
It's a bit more complex than this. Long term, bbp_parse_request() needs to be broken down into several functions that perform explicit tasks. Right now it's serving double duty, parsing only the main query so that it can also setup the global parameters for theme compatibility to function correctly later.
Moving to 2.5.