Filter the arguments passed to wp_dropdown_categories() in the Categories post edit metabox.

The new 'post_edit_category_parent_dropdown_args' provides parity with other
places in wp-admin where `wp_dropdown_categories()` args are filtered, such as
'taxonomy_parent_dropdown_args'.

Props theMikeD.
Fixes #33026.
Built from https://develop.svn.wordpress.org/trunk@33682


git-svn-id: http://core.svn.wordpress.org/trunk@33649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-08-21 01:28:25 +00:00
parent 8b15f8be3d
commit 52614b491a
2 changed files with 39 additions and 2 deletions

View File

@ -510,7 +510,44 @@ function post_categories_meta_box( $post, $box ) {
<label class="screen-reader-text" for="new<?php echo $tax_name; ?>_parent">
<?php echo $taxonomy->labels->parent_item_colon; ?>
</label>
<?php wp_dropdown_categories( array( 'taxonomy' => $tax_name, 'hide_empty' => 0, 'name' => 'new' . $tax_name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $taxonomy->labels->parent_item . ' &mdash;' ) ); ?>
<?php
$parent_dropdown_args = array(
'taxonomy' => $tax_name,
'hide_empty' => 0,
'name' => 'new' . $tax_name . '_parent',
'orderby' => 'name',
'hierarchical' => 1,
'show_option_none' => '&mdash; ' . $taxonomy->labels->parent_item . ' &mdash;',
);
/**
* 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.
* }
*
*/
$parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args );
wp_dropdown_categories( $parent_dropdown_args );
?>
<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 ); ?>" />
<?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?>
<span id="<?php echo $tax_name; ?>-ajax-response"></span>

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-33681';
$wp_version = '4.4-alpha-33682';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.