[wp-trac] [WordPress Trac] #35594: posts_search filter should follow suppress_filters argument
WordPress Trac
noreply at wordpress.org
Sun Jan 24 18:49:24 UTC 2016
#35594: posts_search filter should follow suppress_filters argument
--------------------------+-----------------------------
Reporter: 5um17 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
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
{{{#!php
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']
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35594>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list