$is_bad_attachment_slug =
apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false,
$slug );
if ( $post_name_check ||
in_array( $slug,
$feeds, true
) || 'embed' ===
$slug ||
$is_bad_attachment_slug ) { $suffix = 2;
do { $alt_post_name =
_truncate_post_slug( $slug, 200 -
( strlen( $suffix ) + 1
) ) . "-
$suffix";
$post_name_check =
$wpdb->
get_var( $wpdb->
prepare( $check_sql,
$alt_post_name,
$post_id ) );
$suffix++;
} while ( $post_name_check );
$slug =
$alt_post_name;
} } elseif ( is_post_type_hierarchical( $post_type ) ) { 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.
*/