cac/addon/filtering/taxonomy/terms_args

Deprecated This documentation is deprecated since Admin Columns version 4.
Please view the updated version of this documentation here.

Use this filter cac/addon/filtering/taxonomy/terms_args to change the taxonomy query for theĀ filter dropdown.

Usage

/**
 * Filtering: Change the term arguments used by the taxonomy query for the filter dropwdown
 *
 * @param array $term_args get_terms() arguments
 * @return array get_terms() arguments
 */
function my_filtering_term_args( $term_args ) {

	// Possibly modify $term_args

	return $term_args;
}
add_filter(  'cac/addon/filtering/taxonomy/terms_args', 'my_filtering_term_args' );

Example

In this example we also add the terms to the dropdown that are not being used by a post(type).

/**
 * Display all terms, even when they are not being used
 *
 */
function my_filtering_term_args_show_all_terms( $term_args ) {

	$term_args['hide_empty'] = false;

	return $term_args;
}
add_filter(  'cac/addon/filtering/taxonomy/terms_args', 'my_filtering_term_args_show_all_terms' );