Changeset 13802 for trunk/wp-admin/admin-ajax.php
- Timestamp:
- 03/22/2010 07:56:16 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r13685 r13802 1005 1005 1006 1006 if ( is_array($hidden) ) { 1007 $hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv' ) ); // postboxes that are always shown1007 $hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu') ); // postboxes that are always shown 1008 1008 update_user_option($user->ID, "meta-box-hidden_$page", $hidden); 1009 1009 } … … 1396 1396 } 1397 1397 die( '0' ); 1398 case 'save-custom-link': 1399 if ( ! current_user_can('manage_links') ) 1400 die('-1'); 1401 1402 $link_name = isset( $_POST['link_name'] ) ? esc_html($_POST['link_name']) : null; 1403 $link_url = isset( $_POST['link_url'] ) ? esc_url_raw($_POST['link_url']) : null; 1404 1405 if ( !$link_name || !$link_url ) 1406 die('-1'); 1407 1408 $post = array( 1409 'post_status' => 'draft', 'post_type' => 'nav_menu_item', 'ping_status' => 0, 1410 'post_author' => $user_ID, 'post_title' => $link_name, 'post_excerpt' => '', 1411 'post_parent' => 0, 'menu_order' => 0, 'post_content' => '', 1412 ); 1413 1414 $link_id = wp_insert_post( $post ); 1415 1416 update_post_meta( $link_id, '_menu_item_type', 'custom' ); 1417 update_post_meta( $link_id, '_menu_item_object_id', (int) $link_id ); 1418 update_post_meta( $link_id, '_menu_item_object', 'custom' ); 1419 update_post_meta( $link_id, '_menu_item_target', '_self' ); 1420 update_post_meta( $link_id, '_menu_item_classes', '' ); 1421 update_post_meta( $link_id, '_menu_item_xfn', '' ); 1422 update_post_meta( $link_id, '_menu_item_url', $link_url ); 1423 1424 die( json_encode($link_id) ); 1398 1425 default : 1399 1426 do_action( 'wp_ajax_' . $_POST['action'] );
Note: See TracChangeset
for help on using the changeset viewer.