Skip to content

Commit d1cffae

Browse files
Merge branch 'trunk' into fix/notification-filter-default
2 parents 77bb46d + a8b3395 commit d1cffae

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/wp-includes/post.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,8 +2599,9 @@ function is_post_embeddable( $post = null ) {
25992599
* @see WP_Query
26002600
* @see WP_Query::parse_query()
26012601
*
2602-
* @param array $args {
2603-
* Optional. Arguments to retrieve posts. See WP_Query::parse_query() for all available arguments.
2602+
* @param array|string $args {
2603+
* Optional. Array or query string of arguments to retrieve posts.
2604+
* See WP_Query::parse_query() for all available arguments.
26042605
*
26052606
* @type int $numberposts Total number of posts to retrieve. Is an alias of `$posts_per_page`
26062607
* in WP_Query. Accepts -1 for all. Default 5.

tests/phpunit/tests/post/getPosts.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,17 @@ public function test_explicit_offset_non_0_should_override_paged() {
163163

164164
$this->assertSame( array( $p3 ), $found );
165165
}
166+
167+
/**
168+
* Verifies that get_posts() accepts a query string for the `$args` parameter.
169+
*
170+
* @ticket 64813
171+
*/
172+
public function test_should_accept_query_string_args(): void {
173+
self::factory()->post->create();
174+
$second_post_id = self::factory()->post->create();
175+
$found_post_ids = get_posts( 'numberposts=1&fields=ids' );
176+
177+
$this->assertSame( array( $second_post_id ), $found_post_ids );
178+
}
166179
}

0 commit comments

Comments
 (0)