Support

Account

Home Forums Backend Issues (wp-admin) A filter for taxonomy field

Solved

A filter for taxonomy field

  • Hello Elliot,

    I have a very simple task: a taxonomy field to show in admin a list consisting from only few terms of the taxonomy, not all. So far I wasn’t able to find a filter by which it would be possible to change taxonomy request. Is there any way to achieve this?

    Thanks!

    • Elliot

    • January 19, 2014 at 5:55 pm

    Hi @wpuxsolutions

    Looking at the taxonomy field type file, on line 205 you will see this line of code:

    
    // vars
    		$args = array(
    			'taxonomy'     => $field['taxonomy'],
    			'hide_empty'   => false,
    			'style'        => 'none',
    			'walker'       => new acf_taxonomy_field_walker( $field ),
    		);
    		
    		$args = apply_filters('acf/fields/taxonomy/wp_list_categories', $args, $field );
    

    Using this filter, you can customize the $args. These $args are later used on line 238 in the function wp_list_categories. If you check out this function on WordPress, you will see that there are some params which ‘exclude’.

    Thanks
    E

  • Thanks a lot, Elliot!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.