Created
January 5, 2020 20:37
-
-
Save yokada/8d2fdbeb5a662acb6890357a202b4863 to your computer and use it in GitHub Desktop.
In WordPress ACF, filter tree of taxonomy field_type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('acf/fields/taxonomy/wp_list_categories/name=mycat-tree1', 'mycat1_filter', 10, 2); | |
} | |
function mycat1_filter($args, $field) { | |
$cat = get_category_by_slug('mycat1-slug'); | |
if (empty($cat)) { | |
return $args; | |
} | |
$args['parent'] = $cat->cat_ID; | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment