Make WordPress Core

Ticket #29853: edit-tag-form2.diff

File edit-tag-form2.diff, 2.8 KB (added by TimothyBlynJacobs, 11 years ago)

Filters the taxonomy dropdown args with a separate filter.

  • edit-tag-form.php

     
    105105                <tr class="form-field term-parent-wrap">
    106106                        <th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th>
    107107                        <td>
    108                                 <?php wp_dropdown_categories(array('hide_empty' => 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'))); ?>
     108                                <?php
     109                                $dropdown_args = array(
     110                                        'hide_empty'        => 0,
     111                                        'hide_if_empty'     => false,
     112                                        'name'              => 'parent',
     113                                        'orderby'           => 'name',
     114                                        'taxonomy'          => $taxonomy,
     115                                        'selected'          => $tag->parent,
     116                                        'exclude_tree'      => $tag->term_id,
     117                                        'hierarchical'      => true,
     118                                        'show_option_none'  => __('None')
     119                                );
     120
     121                                /**
     122                                 * Filter the taxonomy parent drop-down on the Single Edit Term page.
     123                                 *
     124                                 * @since ?
     125                                 *
     126                                 * @param array  $dropdown_args {
     127                                 *     An array of taxonomy parent drop-down arguments.
     128                                 *
     129                                 *     @type int|bool        $hide_empty        Whether to hide terms not attached to any posts. Default 0|false.
     130                                 *     @type bool            $hide_if_empty     Whether to hide the drop-down if no terms exist. Default false.
     131                                 *     @type string          $name              The name attribute value for select element. Default 'parent'.
     132                                 *     @type string          $orderby           The field to order by. Default 'name'.
     133                                 *     @type string          $taxonomy          The taxonomy slug.
     134                                 *     @type int             $selected          Which category ID is selected.
     135                                 *     @type array|string    $exclude_tree      Array or comma/space-separated string of term ids to exclude
     136                                 *                                              along with all of their descendant terms. If $include is
     137                                 *                                              non-empty, $exclude_tree is ignored. Default current term ID.
     138                                 *     @type bool            $hierarchical      Whether the taxonomy is hierarchical. Default true.
     139                                 *     @type string          $show_option_none  Label to display if there are no terms. Default 'None'.
     140                                 * }
     141                                 * @param string $taxonomy The taxonomy slug.
     142                                 */
     143                                $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args_single', $dropdown_args, $taxonomy );
     144                                wp_dropdown_categories( $dropdown_args ); ?>
    109145                                <?php if ( 'category' == $taxonomy ) : ?>
    110146                                <p class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p>
    111147                                <?php endif; ?>