Make WordPress Core


Ignore:
Timestamp:
03/12/2010 09:57:52 PM (15 years ago)
Author:
ryan
Message:

Always use lowercase strings or menu type. Don't double save custom link menu items (remove the AJAX save). see #12566

File:
1 edited

Legend:

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

    r13551 r13685  
    477477    _wp_ajax_delete_comment_response( $comment->comment_ID );
    478478    die( '0' );
    479     break;
    480 case 'add-menu-link':
    481     if ( !current_user_can( 'manage_links' ) )
    482         die('-1');
    483    
    484     $link_url = isset($_POST['link_url']) ? $_POST['link_url'] : false;
    485     $link_name = isset($_POST['link_name']) ? $_POST['link_name'] : false;
    486    
    487     if ( !$link_url || !$link_name )
    488         die('-1');
    489    
    490     $post = array( 'post_type' => 'nav_menu_item', 'post_title' => $link_name, 'ping_status' => false, 'post_excerpt' => '', 'post_content' => '' );
    491     $db_id = wp_insert_post( $post );
    492 
    493     update_post_meta( $db_id, 'menu_type', 'custom' );
    494     update_post_meta( $db_id, 'object_id', '' );
    495     update_post_meta( $db_id, 'menu_new_window', 0 );
    496     update_post_meta( $db_id, 'menu_link', esc_url_raw( $link_url ) );
    497    
    498     echo $db_id;
    499479    break;
    500480case 'add-link-category' : // On the Fly
Note: See TracChangeset for help on using the changeset viewer.