This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
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 )
Description
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.
Parameters
- $parent_dropdown_args : (array) Array of arguments to generate parent dropdown.
‘taxonomy’
(string) Name of the taxonomy to retrieve.
‘hide_if_empty’
(bool) True to skip generating markup if no categories are found. Default 0.
‘name’
(string) Value for the ‘name’ attribute of the select element. Default “new{$tax_name}_parent”.
‘orderby’
(string) Which column to use for ordering terms. Default ‘name’.
‘hierarchical’
(bool|int) Whether to traverse the taxonomy hierarchy. Default 1.
‘show_option_none’
(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 );
Explore the latest in WordPress
Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.