Skip to content

Instantly share code, notes, and snippets.

@yokada
Created January 5, 2020 20:37
Show Gist options
  • Save yokada/8d2fdbeb5a662acb6890357a202b4863 to your computer and use it in GitHub Desktop.
Save yokada/8d2fdbeb5a662acb6890357a202b4863 to your computer and use it in GitHub Desktop.
In WordPress ACF, filter tree of taxonomy field_type
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