apply_filters( 'relevanssi_admin_search_ok', boolean $admin_search_ok, WP_Query $query )

Filters whether the admin search should run or not.


(boolean) If true, the admin search will be allowed; if false, the search will not happen.

(WP_Query) The WP_Query object for the query.

More information

As a part of relevanssi_prevent_default_request() function which blocks the default WP search query if Relevanssi is running, this filter hook is used to control whether the default query should be blocked or not. If this filter returns false, the default query will not be blocked. If this filter returns true, the default query may be blocked.

Relevanssi admin search is always disabled when DOING_AJAX is enabled and when the admin search is done with a hierarchical post type ($query->query['fields'] is set to id=>parent), because Relevanssi does not work with those admin searches.

Default functions on the hook

Relevanssi runs relevanssi_block_on_admin_searches() on this hook so the filter relevanssi_admin_search_blocked_post_types can stop Relevanssi from running on specific post types.

The Pretty Links compatibility code adds a function that will return false when the post type in the query is set to pretty-link.