Code Duplication    Length = 5-5 lines in 3 locations

src/wp-includes/post.php 3 locations

@@ 3699-3703 (lines=5) @@
3696
		 */
3697
		if ( $post_name_check || in_array( $slug, $feeds ) || 'embed' === $slug || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) {
3698
			$suffix = 2;
3699
			do {
3700
				$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3701
				$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_ID ) );
3702
				$suffix++;
3703
			} while ( $post_name_check );
3704
			$slug = $alt_post_name;
3705
		}
3706
	} elseif ( is_post_type_hierarchical( $post_type ) ) {
@@ 3729-3733 (lines=5) @@
3726
		 */
3727
		if ( $post_name_check || in_array( $slug, $feeds ) || 'embed' === $slug || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug )  || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) {
3728
			$suffix = 2;
3729
			do {
3730
				$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3731
				$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID, $post_parent ) );
3732
				$suffix++;
3733
			} while ( $post_name_check );
3734
			$slug = $alt_post_name;
3735
		}
3736
	} else {
@@ 3774-3778 (lines=5) @@
3771
		 */
3772
		if ( $post_name_check || in_array( $slug, $feeds ) || 'embed' === $slug || $conflicts_with_date_archive || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) {
3773
			$suffix = 2;
3774
			do {
3775
				$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3776
				$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) );
3777
				$suffix++;
3778
			} while ( $post_name_check );
3779
			$slug = $alt_post_name;
3780
		}
3781
	}