mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Query: Respect 'suppress_filters' when filtering search-related SQL.
Props 5um17. Fixes #35594. git-svn-id: https://develop.svn.wordpress.org/trunk@36404 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -159,4 +159,24 @@ class Tests_Query_Search extends WP_UnitTestCase {
|
||||
|
||||
$this->assertEqualSets( array( $p2 ), $q->posts );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35594
|
||||
*/
|
||||
public function test_search_should_respect_suppress_filters() {
|
||||
add_filter( 'posts_search', array( $this, 'filter_posts_search' ) );
|
||||
add_filter( 'posts_search_orderby', array( $this, 'filter_posts_search' ) );
|
||||
$q = new WP_Query( array(
|
||||
's' => 'foo',
|
||||
'suppress_filters' => true,
|
||||
) );
|
||||
remove_filter( 'posts_search', array( $this, 'filter_posts_search' ) );
|
||||
remove_filter( 'posts_search_orderby', array( $this, 'filter_posts_search' ) );
|
||||
|
||||
$this->assertNotContains( 'posts_search', $q->request );
|
||||
}
|
||||
|
||||
public function filter_posts_search( $sql ) {
|
||||
return $sql . ' /* posts_search */';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user