acp/search/filters

This filter allows you to alter the settings for a smart filter. Notice that it is only possible to remove operators such as (equals, not equals, etc) and set values for some of the drop-down menus.

Usage

add_filter('acp/search/filters', function( $filter, AC\Column $column ){
	// Alter the filter setting for a specific column

	return $filter;
},10, 2);

Example

This example unsets the ‘Not contains’ operator for the Post Format column. It also completely overwrites the values for the drop-down menu.

add_filter('acp/search/filters', function( $filter, AC\Column $column ){

	if( $column instanceof ACP\Column\Post\Formats ){
		// Unset Operators (only unset is possible, otherwise it will lead to fatal errors
		unset( $filter['operators'][ array_search( 'not_equal', $filter['operators'] ) ] );

		// Set custom values
		$filter['values'] = [
			'post-format-standard' => 'Standard',
			'post-format-aside' => 'Aside',
		];
	}

	return $filter;
},10, 2);