Changeset 13685 for trunk/wp-admin/admin-ajax.php
- Timestamp:
- 03/12/2010 09:57:52 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r13551 r13685 477 477 _wp_ajax_delete_comment_response( $comment->comment_ID ); 478 478 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;499 479 break; 500 480 case 'add-link-category' : // On the Fly
Note: See TracChangeset
for help on using the changeset viewer.