Support

Account

Forum Replies Created

  • This works (for me)

    
    add_filter('acf/load_field/key={FIELD_KEY}', 'load_just_categories_filter', 12, 1);
    
    function load_just_categories_filter( $field ) {
        
        $terms = get_terms( array(
            'taxonomy' => 'category',
            'hide_empty' => false
        ) );
        if ( !empty($terms) ) {
            foreach( $terms as $term ) {
                $field['taxonomy'][] = 'category:'.$term->slug;
            }
        }
    
        return $field;
    }
    
  • Something like this :

    function load_recipe_category_filter( $field ) {
        
        $terms = get_terms( array(
            'taxonomy' => 'recipe_category',
            'hide_empty' => false
        ) );
        if ( !empty($terms) ) {
            foreach( $terms as $term ) {
                $field['taxonomy'][] = 'recipe_category:'.$term->slug;
            }
        }
    
        return $field;
    }
    
    add_filter('acf/load_field/key=field_5899e67cc9f5fff', 'load_recipe_category_filter');
Viewing 2 posts - 1 through 2 (of 2 total)