Make WordPress Core

Ticket #34657: 34657.patch

File 34657.patch, 1.2 KB (added by rss_samuel, 8 years ago)

I change /wp-admin/includes/ajax-actions.php file.

  • wp-admin/includes/ajax-actions.php

    diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
    index b6bd757..132ff47 100644
    a b function wp_ajax_edit_comment() { 
    11491149function wp_ajax_add_menu_item() {
    11501150        check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
    11511151
    1152         if ( ! current_user_can( 'edit_theme_options' ) )
     1152        if ( ! current_user_can( 'edit_theme_options' ) or ! isset( $_POST['menu'] ) )
    11531153                wp_die( -1 );
    11541154
    11551155        require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
    function wp_ajax_add_menu_item() { 
    11571157        // For performance reasons, we omit some object properties from the checklist.
    11581158        // The following is a hacky way to restore them when adding non-custom items.
    11591159
     1160        $menu_id = (int) $_POST['menu'];
    11601161        $menu_items_data = array();
    11611162        foreach ( (array) $_POST['menu-item'] as $menu_item_data ) {
    11621163                if (
    function wp_ajax_add_menu_item() { 
    11881189                $menu_items_data[] = $menu_item_data;
    11891190        }
    11901191
    1191         $item_ids = wp_save_nav_menu_items( 0, $menu_items_data );
     1192        $item_ids = wp_save_nav_menu_items( $menu_id, $menu_items_data );
    11921193        if ( is_wp_error( $item_ids ) )
    11931194                wp_die( 0 );
    11941195