Skip to content

Instantly share code, notes, and snippets.

@tomusborne
Created December 19, 2016 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomusborne/221ae5b5fc6a106f95b4948e2ce90ca9 to your computer and use it in GitHub Desktop.
Save tomusborne/221ae5b5fc6a106f95b4948e2ce90ca9 to your computer and use it in GitHub Desktop.
Limit taxonomy depth to 1
add_filter( 'taxonomy_parent_dropdown_args', 'limit_parents_wpse_tax_page', 10, 2 );
add_filter( 'post_edit_category_parent_dropdown_args', 'limit_parents_wpse_tax_page' );
function limit_parents_wpse_tax_page( $args ) {
if ( 'YOUR_TAXONOMY' != $args['taxonomy'] ) return $args;
$args['depth'] = '1';
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment