Filter hook 'post_edit_category_parent_dropdown_args'

in WP Core File wp-admin/includes/meta-boxes.php at line 724

View Source

post_edit_category_parent_dropdown_args

Filter Hook
Description
Filters the arguments for the taxonomy parent dropdown on the Post Edit page. categories are found. Default 0. of the select element. Default "new{$tax_name}_parent". terms. Default 'name'. hierarchy. Default 1. Default "— {$parent} —", where `$parent` is 'parent_item' taxonomy label. }

Hook Information

File Location wp-admin/includes/meta-boxes.php View on GitHub
Hook Type Filter
Line Number 724

Hook Parameters

Type Name Description
array $parent_dropdown_args { Optional. Array of arguments to generate parent dropdown.

Usage Examples

Basic Usage
<?php
// Hook into post_edit_category_parent_dropdown_args
add_filter('post_edit_category_parent_dropdown_args', 'my_custom_filter', 10, 1);

function my_custom_filter($parent_dropdown_args) {
    // Your custom filtering logic here
    return $parent_dropdown_args;
}

Source Code Context

wp-admin/includes/meta-boxes.php:724 - How this hook is used in WordPress core
<?php
 719  					 *                                      Default "&mdash; {$parent} &mdash;",
 720  					 *                                      where `$parent` is 'parent_item'
 721  					 *                                      taxonomy label.
 722  					 * }
 723  					 */
 724  					$parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args );
 725  
 726  					wp_dropdown_categories( $parent_dropdown_args );
 727  					?>
 728  					<input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $taxonomy->labels->add_new_item ); ?>" />
 729  					<?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?>

PHP Documentation

<?php
/**
					 * Filters the arguments for the taxonomy parent dropdown on the Post Edit page.
					 *
					 * @since 4.4.0
					 *
					 * @param array $parent_dropdown_args {
					 *     Optional. Array of arguments to generate parent dropdown.
					 *
					 *     @type string   $taxonomy         Name of the taxonomy to retrieve.
					 *     @type bool     $hide_if_empty    True to skip generating markup if no
					 *                                      categories are found. Default 0.
					 *     @type string   $name             Value for the 'name' attribute
					 *                                      of the select element.
					 *                                      Default "new{$tax_name}_parent".
					 *     @type string   $orderby          Which column to use for ordering
					 *                                      terms. Default 'name'.
					 *     @type bool|int $hierarchical     Whether to traverse the taxonomy
					 *                                      hierarchy. Default 1.
					 *     @type string   $show_option_none Text to display for the "none" option.
					 *                                      Default "&mdash; {$parent} &mdash;",
					 *                                      where `$parent` is 'parent_item'
					 *                                      taxonomy label.
					 * }
					 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-admin/includes/meta-boxes.php
Related Hooks

Related hooks will be displayed here in future updates.