- <?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —' ) ); ?>
- <input type="button" id="<?php echo $taxonomy; ?>-add-submit" data-wp-lists="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
- <?php wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce-add-'.$taxonomy, false ); ?>
- <span id="<?php echo $taxonomy; ?>-ajax-response"></span>
+ <?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 ); ?>" />
+ <?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?>
+ <span id="<?php echo $tax_name; ?>-ajax-response"></span>