Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#35594 closed defect (bug) (fixed)

posts_search filter should follow suppress_filters argument

Reported by: 5um17's profile 5um17 Owned by: boonebgorges's profile boonebgorges
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: Query Keywords: has-patch
Focuses: Cc:


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.


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)

35594.patch (1.2 KB) - added by 5um17 8 years ago.
Patch with conditional posts_search filter

Download all attachments as: .zip

Change History (5)

#1 @5um17
8 years ago

  • Keywords dev-feedback added

8 years ago

Patch with conditional posts_search filter

#2 @5um17
8 years ago

  • Keywords has-patch added

#3 @boonebgorges
8 years ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to 4.5

Agreed. This is surely an oversight.

#4 @boonebgorges
8 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 36404:

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

Props 5um17.
Fixes #35594.

Note: See TracTickets for help on using tickets.