Opened 10 years ago
Closed 10 years ago
#35594 closed defect (bug) (fixed)
posts_search filter should follow suppress_filters argument
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.5 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Query | Keywords: | has-patch |
| Focuses: | Cc: |
Description
I am not sure if it has been done intentionally for some purpose, but I believe that filtering of where clause in SQL should be consistence.
Passing 'suppress_filters' => true disable posts_where filter but posts_search stays in action. It mean we are still able to modify the where clause only for search query but not for other queries.
It may cause SQL errors because some filters will be active and some will not.
Example
add_filter( 'posts_search', array($this, 'wp_es_custom_query'), 500, 2 );
add_filter('posts_join_request', array($this, 'wp_es_join_table'));
Produce this error when suppress_filters is true
WordPress database error: [Unknown column 'tt.taxonomy' in 'where clause']
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
Patch with conditional
posts_searchfilter