From 70c394fb791554bd12a12c5d0455a84f77ff6a50 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 15 Oct 2012 14:13:57 +0000 Subject: [PATCH] Avoid queries in wp_unique_post_slug() for nav menu items. see #22189. git-svn-id: https://develop.svn.wordpress.org/trunk@22232 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wp-includes/post.php b/wp-includes/post.php index 7c9d6c67b1..4b8cc77b8d 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2951,6 +2951,8 @@ function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p $slug = $alt_post_name; } } elseif ( in_array( $post_type, $hierarchical_post_types ) ) { + if ( 'nav_menu_item' == $post_type ) + return $slug; // Page slugs must be unique within their own trees. Pages are in a separate // namespace than posts so page slugs are allowed to overlap post slugs. $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";