Make WordPress Core

Changeset 30998


Ignore:
Timestamp:
12/29/2014 03:26:51 PM (10 years ago)
Author:
boonebgorges
Message:

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.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-tag-form.php

    r30842 r30998  
    107107            <th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th>
    108108            <td>
    109                 <?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'))); ?>
     109                <?php
     110                $dropdown_args = array(
     111                    'hide_empty'       => 0,
     112                    'hide_if_empty'    => false,
     113                    'taxonomy'         => $taxonomy,
     114                    'name'             => 'parent',
     115                    'orderby'          => 'name',
     116                    'selected'         => $tag->parent,
     117                    'exclude_tree'     => $tag->term_id,
     118                    'hierarchical'     => true,
     119                    'show_option_none' => __( 'None' ),
     120                );
     121
     122                /** This filter is documented in wp-admin/edit-tags.php */
     123                $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' );
     124                wp_dropdown_categories( $dropdown_args ); ?>
    110125                <?php if ( 'category' == $taxonomy ) : ?>
    111126                <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>
  • trunk/src/wp-admin/edit-tags.php

    r30842 r30998  
    479479     *
    480480     * @since 3.7.0
     481     * @since 4.1.0 Added $context parameter.
    481482     *
    482483     * @param array  $dropdown_args {
     
    493494     * }
    494495     * @param string $taxonomy The taxonomy slug.
     496     * @param string $context  Filter context. Accepts 'new' or 'edit'.
    495497     */
    496     $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy );
     498    $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' );
    497499    wp_dropdown_categories( $dropdown_args );
    498500    ?>
Note: See TracChangeset for help on using the changeset viewer.