post_edit_category_parent_dropdown_args filter

Filters the arguments for the taxonomy parent dropdown on the Post Edit page.

apply_filters( 'post_edit_category_parent_dropdown_args', array $parent_dropdown_args )


This hook is used filter the arguments for taxonomy parent dropdown on post edit page.

It gives a dropdown of all taxonomy with same parent, for given arguments.


  • $parent_dropdown_args : (array) Array of arguments to generate parent dropdown.
    (string) Name of the taxonomy to retrieve.
    (bool) True to skip generating markup if no categories are found. Default 0.
    (string) Value for the ‘name’ attribute of the select element. Default “new{$tax_name}_parent”.
    (string) Which column to use for ordering terms. Default ‘name’.
    (bool|int) Whether to traverse the taxonomy hierarchy. Default 1.
    (string) Text to display for the “none” option. Default “— {$parent} —”, where $parent is ‘parent_item’ taxonomy label.

Live Example

To run the hook, copy the example below.

$parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args ); 
if ( !empty( $parent_dropdown_args ) ) { 
   // everything has led up to this point... 

The following example is for adding a hook callback.

// define the post_edit_category_parent_dropdown_args callback 
function filter_post_edit_category_parent_dropdown_args( $parent_dropdown_args ) { 
    // make filter magic happen here... 
    return $parent_dropdown_args; 
// add the filter 
add_filter( 'post_edit_category_parent_dropdown_args', 'filter_post_edit_category_parent_dropdown_args', 10, 1 ); 

To remove a hook callback, use the example below.

// remove the filter 
remove_filter( 'post_edit_category_parent_dropdown_args', 'filter_post_edit_category_parent_dropdown_args', 10, 1 ); 

 Subscribe to our weekly newsletter below and never miss the latest updates in WordPress