Make WordPress Core

Ticket #22189: 22189.diff

File 22189.diff, 680 bytes (added by nacin, 13 years ago)

Avoid querying for slugs in wp_unique_post_slug(). We may want to introduce a pre_* filter here in the future.

  • wp-includes/post.php

     
    29362936                $feeds = array();
    29372937
    29382938        $hierarchical_post_types = get_post_types( array('hierarchical' => true) );
    2939         if ( 'attachment' == $post_type ) {
     2939        if ( 'nav_menu_item' == $post_type ) {
     2940                return $slug;
     2941        } elseif ( 'attachment' == $post_type ) {
    29402942                // Attachment slugs must be unique across all types.
    29412943                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
    29422944                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) );