WordPress.org

Make WordPress Core

Ticket #8682: 8682.001.diff

File 8682.001.diff, 1.9 KB (added by AaronCampbell, 9 years ago)
  • wp-includes/category-template.php

     
    717717 * @see Walker_Category::walk() for parameters and return description.
    718718 */
    719719function walk_category_tree() {
    720         $walker = new Walker_Category;
    721720        $args = func_get_args();
     721        // the user's options are the third parameter
     722        if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
     723                $walker = new Walker_Category;
     724        else
     725                $walker = $args[2]['walker'];
     726
    722727        return call_user_func_array(array( &$walker, 'walk' ), $args );
    723728}
    724729
     
    730735 * @see Walker_CategoryDropdown::walk() for parameters and return description.
    731736 */
    732737function walk_category_dropdown_tree() {
    733         $walker = new Walker_CategoryDropdown;
    734738        $args = func_get_args();
     739        // the user's options are the third parameter
     740        if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
     741                $walker = new Walker_CategoryDropdown;
     742        else
     743                $walker = $args[2]['walker'];
     744
    735745        return call_user_func_array(array( &$walker, 'walk' ), $args );
    736746}
    737747
  • wp-admin/includes/template.php

     
    439439 * @param unknown_type $selected_cats
    440440 * @param unknown_type $popular_cats
    441441 */
    442 function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false ) {
    443         $walker = new Walker_Category_Checklist;
     442function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null ) {
     443        if ( empty($walker) || !is_a($walker, 'Walker') )
     444                $walker = new Walker_Category_Checklist;
     445
    444446        $descendants_and_self = (int) $descendants_and_self;
    445447
    446448        $args = array();