Code Duplication    Length = 13-14 lines in 2 locations

modules/search/class.jetpack-search-helpers.php 1 location

@@ 399-412 (lines=14) @@
396
	 *
397
	 * @return string $url The URL with added post types.
398
	 */
399
	public static function add_post_types_to_url( $url, $post_types ) {
400
		$url = Jetpack_Search_Helpers::remove_query_arg( 'post_type', $url );
401
		if ( empty( $post_types ) ) {
402
			return $url;
403
		}
404
405
		$url = Jetpack_Search_Helpers::add_query_arg(
406
			'post_type',
407
			implode( ',', $post_types ),
408
			$url
409
		);
410
411
		return $url;
412
	}
413
414
	/**
415
	 * Since we provide support for the widget restricting post types by adding the selected post types as

modules/search/class.jetpack-search-widget-filters.php 1 location

@@ 739-751 (lines=13) @@
736
	 * @param string $url
737
	 * @param array  $post_types
738
	 */
739
	function add_post_types_to_url( $url, $post_types ) {
740
		$url = Jetpack_Search_Helpers::remove_query_arg( 'post_type', $url );
741
		if ( empty( $post_types ) ) {
742
			return $url;
743
		}
744
745
		$url = Jetpack_Search_Helpers::add_query_arg(
746
			'post_type',
747
			implode( ',', $post_types )
748
		);
749
750
		return $url;
751
	}
752
753
	/**
754
	 * Renders the current filters applied to the search.