From 51d9fc0ad13ec1f86789d3c9a03471711cd5821f Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Mon, 29 Dec 2014 15:26:51 +0000 Subject: [PATCH] Apply 'taxonomy_parent_dropdown_args' filter when editing terms. Added in WP 3.7 [25123], the 'taxonomy_parent_dropdown_args' filter affected only the term creation interface. This changeset introduces parity by ensuring that it is applied when editing terms as well. The new `$context` parameter indicates whether the filter is being applied in a 'new' or 'edit' context. Props TimothyBlynJacobs, DrewAPicture. Fixes #29853. git-svn-id: https://develop.svn.wordpress.org/trunk@30998 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-tag-form.php | 17 ++++++++++++++++- src/wp-admin/edit-tags.php | 4 +++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/edit-tag-form.php b/src/wp-admin/edit-tag-form.php index 94a26bbdd2..73db25b00f 100644 --- a/src/wp-admin/edit-tag-form.php +++ b/src/wp-admin/edit-tag-form.php @@ -106,7 +106,22 @@ do_action( "{$taxonomy}_term_edit_form_tag" ); - 0, 'hide_if_empty' => false, 'name' => 'parent', 'orderby' => 'name', 'taxonomy' => $taxonomy, 'selected' => $tag->parent, 'exclude_tree' => $tag->term_id, 'hierarchical' => true, 'show_option_none' => __('None'))); ?> + 0, + 'hide_if_empty' => false, + 'taxonomy' => $taxonomy, + 'name' => 'parent', + 'orderby' => 'name', + 'selected' => $tag->parent, + 'exclude_tree' => $tag->term_id, + 'hierarchical' => true, + 'show_option_none' => __( 'None' ), + ); + + /** This filter is documented in wp-admin/edit-tags.php */ + $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' ); + wp_dropdown_categories( $dropdown_args ); ?>

diff --git a/src/wp-admin/edit-tags.php b/src/wp-admin/edit-tags.php index e0cd746ed4..973d0ebf1e 100644 --- a/src/wp-admin/edit-tags.php +++ b/src/wp-admin/edit-tags.php @@ -478,6 +478,7 @@ do_action( "{$taxonomy}_term_new_form_tag" ); * Filter the taxonomy parent drop-down on the Edit Term page. * * @since 3.7.0 + * @since 4.1.0 Added $context parameter. * * @param array $dropdown_args { * An array of taxonomy parent drop-down arguments. @@ -492,8 +493,9 @@ do_action( "{$taxonomy}_term_new_form_tag" ); * @type string $show_option_none Label to display if there are no terms. Default 'None'. * } * @param string $taxonomy The taxonomy slug. + * @param string $context Filter context. Accepts 'new' or 'edit'. */ - $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy ); + $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' ); wp_dropdown_categories( $dropdown_args ); ?>