Make WordPress Core

Changeset 60492


Ignore:
Timestamp:
07/21/2025 06:16:00 PM (15 months ago)
Author:
johnjamesjacoby
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r60276 r60492  
    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();
Note: See TracChangeset for help on using the changeset viewer.