mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 15:47:38 +02:00
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:
parent
8b15f8be3d
commit
52614b491a
@ -510,7 +510,44 @@ function post_categories_meta_box( $post, $box ) {
|
|||||||
<label class="screen-reader-text" for="new<?php echo $tax_name; ?>_parent">
|
<label class="screen-reader-text" for="new<?php echo $tax_name; ?>_parent">
|
||||||
<?php echo $taxonomy->labels->parent_item_colon; ?>
|
<?php echo $taxonomy->labels->parent_item_colon; ?>
|
||||||
</label>
|
</label>
|
||||||
<?php wp_dropdown_categories( array( 'taxonomy' => $tax_name, 'hide_empty' => 0, 'name' => 'new' . $tax_name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —' ) ); ?>
|
<?php
|
||||||
|
$parent_dropdown_args = array(
|
||||||
|
'taxonomy' => $tax_name,
|
||||||
|
'hide_empty' => 0,
|
||||||
|
'name' => 'new' . $tax_name . '_parent',
|
||||||
|
'orderby' => 'name',
|
||||||
|
'hierarchical' => 1,
|
||||||
|
'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —',
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 "— {$parent} —",
|
||||||
|
* 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 ); ?>" />
|
<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 ); ?>
|
<?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?>
|
||||||
<span id="<?php echo $tax_name; ?>-ajax-response"></span>
|
<span id="<?php echo $tax_name; ?>-ajax-response"></span>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user