mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-09 07:00:01 +00:00
Move code out of the conditional. props duck_, fixes #14415.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b7392b4efd
commit
a512dbefb2
@ -743,10 +743,9 @@ case 'add-menu-item' :
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
|
||||
|
||||
/**
|
||||
* For performance reasons, we omit some object properties from the checklist.
|
||||
* The following is a hacky way to restore them when adding non-custom items.
|
||||
*/
|
||||
// For performance reasons, we omit some object properties from the checklist.
|
||||
// The following is a hacky way to restore them when adding non-custom items.
|
||||
|
||||
$menu_items_data = (array) $_POST['menu-item'];
|
||||
$menu_item_data = array_shift( $menu_items_data );
|
||||
if (
|
||||
@ -767,12 +766,12 @@ case 'add-menu-item' :
|
||||
$_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) );
|
||||
$_menu_item = array_shift( $_menu_items );
|
||||
|
||||
/** Restore the missing menu item properties **/
|
||||
// Restore the missing menu item properties
|
||||
$menu_item_data['menu-item-description'] = $_menu_item->description;
|
||||
|
||||
$menu_items_data = array( $menu_item_data );
|
||||
}
|
||||
|
||||
$menu_items_data = array( $menu_item_data );
|
||||
|
||||
$item_ids = wp_save_nav_menu_items( 0, $menu_items_data );
|
||||
if ( is_wp_error( $item_ids ) )
|
||||
die('-1');
|
||||
|
@ -3097,6 +3097,7 @@ function &get_page(&$page, $output = OBJECT, $filter = 'raw') {
|
||||
*/
|
||||
function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') {
|
||||
global $wpdb;
|
||||
$null = null;
|
||||
$page_path = rawurlencode(urldecode($page_path));
|
||||
$page_path = str_replace('%2F', '/', $page_path);
|
||||
$page_path = str_replace('%20', ' ', $page_path);
|
||||
@ -3110,7 +3111,7 @@ function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') {
|
||||
$pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = %s AND (post_type = %s OR post_type = 'attachment')", $leaf_path, $post_type ));
|
||||
|
||||
if ( empty($pages) )
|
||||
return null;
|
||||
return $null;
|
||||
|
||||
foreach ( $pages as $page ) {
|
||||
$path = '/' . $leaf_path;
|
||||
@ -3124,7 +3125,7 @@ function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') {
|
||||
return get_page($page->ID, $output, $post_type);
|
||||
}
|
||||
|
||||
return null;
|
||||
return $null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user