diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 0f38c6479b..49b7017ad0 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -1620,9 +1620,9 @@ class WP_Query { break; case 'post_name__in': if ( ! empty( $this->query_vars['post_name__in'] ) ) { - $post_name__in = array_map( 'sanitize_title_for_query', $this->query_vars['post_name__in'] ); + $post_name__in = array_map( 'sanitize_title_for_query', $this->query_vars['post_name__in'] ); $post_name__in_string = "'" . implode( "','", $post_name__in ) . "'"; - $orderby_clause = "FIELD( {$wpdb->posts}.post_name," . $post_name__in_string . ' )'; + $orderby_clause = "FIELD( {$wpdb->posts}.post_name," . $post_name__in_string . ' )'; } break; default: diff --git a/tests/phpunit/tests/post/query.php b/tests/phpunit/tests/post/query.php index 1112c87e04..e1075bc46b 100644 --- a/tests/phpunit/tests/post/query.php +++ b/tests/phpunit/tests/post/query.php @@ -182,11 +182,13 @@ class Tests_Post_Query extends WP_UnitTestCase { $ordered = array( $posts[2], $posts[0], $posts[3] ); - $q = new WP_Query( array( - 'post_type' => 'any', - 'post__in' => $ordered, - 'orderby' => array( 'post__in' => 'ASC' ), - ) ); + $q = new WP_Query( + array( + 'post_type' => 'any', + 'post__in' => $ordered, + 'orderby' => array( 'post__in' => 'ASC' ), + ) + ); $this->assertSame( $ordered, wp_list_pluck( $q->posts, 'ID' ) ); } @@ -198,11 +200,13 @@ class Tests_Post_Query extends WP_UnitTestCase { $ordered = array( $posts[2], $posts[0], $posts[3] ); - $q = new WP_Query( array( - 'post_type' => 'any', - 'post__in' => $ordered, - 'orderby' => 'post__in', - ) ); + $q = new WP_Query( + array( + 'post_type' => 'any', + 'post__in' => $ordered, + 'orderby' => 'post__in', + ) + ); $this->assertSame( $ordered, wp_list_pluck( $q->posts, 'ID' ) ); }