Skip to content

Commit c059a21

Browse files
committed
Taxonomy: Filter the arguments passed into wp_dropdown_categories() in the Categories post edit metabox AJAX request output.
This commit fixes a bug that caused differing dropdown results between AJAX & non-AJAX output, when using the `post_edit_category_parent_dropdown_args` hook. (That hook is documented inside of the `post_categories_meta_box()` function, introduced via r33682 and #33026.) Props obiplabon, birgire. Fixes #44343. git-svn-id: https://develop.svn.wordpress.org/trunk@60492 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 6054027 commit c059a21

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/wp-admin/includes/ajax-actions.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -690,18 +690,21 @@ function _wp_ajax_add_hierarchical_term() {
690690
);
691691
}
692692

693+
$parent_dropdown_args = array(
694+
'taxonomy' => $taxonomy->name,
695+
'hide_empty' => 0,
696+
'name' => 'new' . $taxonomy->name . '_parent',
697+
'orderby' => 'name',
698+
'hierarchical' => 1,
699+
'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —',
700+
);
701+
702+
/** This filter is documented in wp-admin/includes/meta-boxes.php */
703+
$parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args );
704+
693705
ob_start();
694706

695-
wp_dropdown_categories(
696-
array(
697-
'taxonomy' => $taxonomy->name,
698-
'hide_empty' => 0,
699-
'name' => 'new' . $taxonomy->name . '_parent',
700-
'orderby' => 'name',
701-
'hierarchical' => 1,
702-
'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —',
703-
)
704-
);
707+
wp_dropdown_categories( $parent_dropdown_args );
705708

706709
$sup = ob_get_clean();
707710

0 commit comments

Comments
 (0)