Code Duplication    Length = 16-16 lines in 2 locations

wp-includes/class-wp-customize-nav-menus.php 2 locations

@@ 167-182 (lines=16) @@
164
				'order'       => 'DESC',
165
				'post_type'   => $object,
166
			) );
167
			foreach ( $posts as $post ) {
168
				$post_title = $post->post_title;
169
				if ( '' === $post_title ) {
170
					/* translators: %d: ID of a post */
171
					$post_title = sprintf( __( '#%d (no title)' ), $post->ID );
172
				}
173
				$items[] = array(
174
					'id'         => "post-{$post->ID}",
175
					'title'      => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),
176
					'type'       => 'post_type',
177
					'type_label' => get_post_type_object( $post->post_type )->labels->singular_name,
178
					'object'     => $post->post_type,
179
					'object_id'  => intval( $post->ID ),
180
					'url'        => get_permalink( intval( $post->ID ) ),
181
				);
182
			}
183
		} elseif ( 'taxonomy' === $type ) {
184
			$terms = get_terms( $object, array(
185
				'child_of'     => 0,
@@ 296-311 (lines=16) @@
293
294
		// Check if any posts were found.
295
		if ( $get_posts->post_count ) {
296
			foreach ( $get_posts->posts as $post ) {
297
				$post_title = $post->post_title;
298
				if ( '' === $post_title ) {
299
					/* translators: %d: ID of a post */
300
					$post_title = sprintf( __( '#%d (no title)' ), $post->ID );
301
				}
302
				$items[] = array(
303
					'id'         => 'post-' . $post->ID,
304
					'title'      => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),
305
					'type'       => 'post_type',
306
					'type_label' => $post_type_objects[ $post->post_type ]->labels->singular_name,
307
					'object'     => $post->post_type,
308
					'object_id'  => intval( $post->ID ),
309
					'url'        => get_permalink( intval( $post->ID ) ),
310
				);
311
			}
312
		}
313
314
		// Query taxonomy terms.