acp/filtering/dropdown_args

This Filter allows you to alter the filter settings for a column.
Filter acp/filtering/dropdown_args

Usage

/**
 * Filter settings
 *
 * @param array     $args {
 *      Filtering settings.
 *
 *      @type string        $current_item   Current value, is set dynamically based
 *      @type bool|array    $empty_option   Enable the empty / non empty values for filtering
 *      @type array         $options        Optional. Options for dropdown ([value] => [label])
 *      @type bool          $order
 * }
 *
 * @param AC_Column $column         Column class instance
 */
function acp_filter_dropdown_args( $args, $column ) {

	return $args;
}

add_filter( 'acp/filtering/dropdown_args', 'acp_filter_dropdown_args', 10, 2 );

Example

In this example we hide the “empty” and “not empty” option from a filter menu for a custom field column.

/**
 * Hide empty option from filter menu
 *
 * @param array     $args
 * @param AC_Column $column
 *
 * @return array
 */
function my_ac_filter_menu_remove_empty_options( $args, $column ) {

	$column_type = 'column-meta';

	if ( $column_type === $column->get_type() ) {

		if ( isset( $args['empty_option'] ) ) {
			unset( $args['empty_option'] );
		}
	}

	return $args;
}

add_filter( 'acp/filtering/dropdown_args', 'my_ac_filter_menu_remove_empty_options', 10, 2 );

Legacy

The following filters are replaced by acp/filtering/dropdown_args since Admin Columns Pro 4.0.
cac/addon/filtering/dropdown_empty_option
cac/addon/filtering/options