Query: Respect 'suppress_filters' when filtering search-related SQL.

Props 5um17.
Fixes #35594.
Built from https://develop.svn.wordpress.org/trunk@36404


git-svn-id: http://core.svn.wordpress.org/trunk@36371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2016-01-26 03:12:25 +00:00
parent de89efc4dc
commit e6d2b6cab0
2 changed files with 24 additions and 19 deletions

View File

@ -2790,15 +2790,17 @@ class WP_Query {
$search = $this->parse_search( $q );
}
/**
* Filter the search SQL that is used in the WHERE clause of WP_Query.
*
* @since 3.0.0
*
* @param string $search Search SQL for WHERE clause.
* @param WP_Query $this The current WP_Query object.
*/
$search = apply_filters_ref_array( 'posts_search', array( $search, &$this ) );
if ( ! $q['suppress_filters'] ) {
/**
* Filter the search SQL that is used in the WHERE clause of WP_Query.
*
* @since 3.0.0
*
* @param string $search Search SQL for WHERE clause.
* @param WP_Query $this The current WP_Query object.
*/
$search = apply_filters_ref_array( 'posts_search', array( $search, &$this ) );
}
// Taxonomies
if ( !$this->is_singular ) {
@ -3007,15 +3009,18 @@ class WP_Query {
if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) )
$search_orderby = $this->parse_search_order( $q );
/**
* Filter the ORDER BY used when ordering search results.
*
* @since 3.7.0
*
* @param string $search_orderby The ORDER BY clause.
* @param WP_Query $this The current WP_Query instance.
*/
$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );
if ( ! $q['suppress_filters'] ) {
/**
* Filter the ORDER BY used when ordering search results.
*
* @since 3.7.0
*
* @param string $search_orderby The ORDER BY clause.
* @param WP_Query $this The current WP_Query instance.
*/
$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );
}
if ( $search_orderby )
$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36403';
$wp_version = '4.5-alpha-36404';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.