WordPress.org

Make WordPress Core

Changeset 20072


Ignore:
Timestamp:
03/02/2012 05:50:01 PM (6 years ago)
Author:
nacin
Message:

Add the wp_edit_nav_menu_walker filter to the ajax request. props wonderslug, ocean90. fixes #14527.

File:
1 edited

Legend:

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

    r19934 r20072  
    158158        wp_die( -1 );
    159159    }
    160    
     160
    161161    $return = array();
    162162
     
    174174        'exclude' => $this_blog_users,
    175175        'search_columns' => array( 'user_login', 'user_nicename', 'user_email' ),
    176     ) );   
     176    ) );
    177177
    178178    foreach ( $users as $user ) {
     
    805805
    806806function wp_ajax_add_menu_item() {
     807    check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
     808
    807809    if ( ! current_user_can( 'edit_theme_options' ) )
    808810        wp_die( -1 );
    809 
    810     check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
    811811
    812812    require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
     
    844844    $item_ids = wp_save_nav_menu_items( 0, $menu_items_data );
    845845    if ( is_wp_error( $item_ids ) )
    846         wp_die( -1 );
     846        wp_die( 0 );
    847847
    848848    $menu_items = array();
     
    857857    }
    858858
     859    $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $_POST['menu'] );
     860
     861    if ( ! class_exists( $walker_class_name ) )
     862        wp_die( 0 );
     863
    859864    if ( ! empty( $menu_items ) ) {
    860865        $args = array(
     
    863868            'link_after' => '',
    864869            'link_before' => '',
    865             'walker' => new Walker_Nav_Menu_Edit,
     870            'walker' => new $walker_class_name,
    866871        );
    867872        echo walk_nav_menu_tree( $menu_items, 0, (object) $args );
Note: See TracChangeset for help on using the changeset viewer.