mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Various bug fixes and improvements to menu management. props ptahdunbar, see #11817.
git-svn-id: https://develop.svn.wordpress.org/trunk@13802 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+28
-1
@@ -1004,7 +1004,7 @@ case 'closed-postboxes' :
|
||||
update_user_option($user->ID, "closedpostboxes_$page", $closed);
|
||||
|
||||
if ( is_array($hidden) ) {
|
||||
$hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv') ); // postboxes that are always shown
|
||||
$hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu') ); // postboxes that are always shown
|
||||
update_user_option($user->ID, "meta-box-hidden_$page", $hidden);
|
||||
}
|
||||
|
||||
@@ -1395,6 +1395,33 @@ case 'set-post-thumbnail':
|
||||
}
|
||||
}
|
||||
die( '0' );
|
||||
case 'save-custom-link':
|
||||
if ( ! current_user_can('manage_links') )
|
||||
die('-1');
|
||||
|
||||
$link_name = isset( $_POST['link_name'] ) ? esc_html($_POST['link_name']) : null;
|
||||
$link_url = isset( $_POST['link_url'] ) ? esc_url_raw($_POST['link_url']) : null;
|
||||
|
||||
if ( !$link_name || !$link_url )
|
||||
die('-1');
|
||||
|
||||
$post = array(
|
||||
'post_status' => 'draft', 'post_type' => 'nav_menu_item', 'ping_status' => 0,
|
||||
'post_author' => $user_ID, 'post_title' => $link_name, 'post_excerpt' => '',
|
||||
'post_parent' => 0, 'menu_order' => 0, 'post_content' => '',
|
||||
);
|
||||
|
||||
$link_id = wp_insert_post( $post );
|
||||
|
||||
update_post_meta( $link_id, '_menu_item_type', 'custom' );
|
||||
update_post_meta( $link_id, '_menu_item_object_id', (int) $link_id );
|
||||
update_post_meta( $link_id, '_menu_item_object', 'custom' );
|
||||
update_post_meta( $link_id, '_menu_item_target', '_self' );
|
||||
update_post_meta( $link_id, '_menu_item_classes', '' );
|
||||
update_post_meta( $link_id, '_menu_item_xfn', '' );
|
||||
update_post_meta( $link_id, '_menu_item_url', $link_url );
|
||||
|
||||
die( json_encode($link_id) );
|
||||
default :
|
||||
do_action( 'wp_ajax_' . $_POST['action'] );
|
||||
die('0');
|
||||
|
||||
Reference in New Issue
Block a user