Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/wp-includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -2599,8 +2599,9 @@ function is_post_embeddable( $post = null ) {
* @see WP_Query
* @see WP_Query::parse_query()
*
* @param array $args {
* Optional. Arguments to retrieve posts. See WP_Query::parse_query() for all available arguments.
* @param array|string $args {
* Optional. Array or query string of arguments to retrieve posts.
* See WP_Query::parse_query() for all available arguments.
*
* @type int $numberposts Total number of posts to retrieve. Is an alias of `$posts_per_page`
* in WP_Query. Accepts -1 for all. Default 5.
Expand Down
14 changes: 14 additions & 0 deletions tests/phpunit/tests/post/getPosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,18 @@ public function test_explicit_offset_non_0_should_override_paged() {

$this->assertSame( array( $p3 ), $found );
}

/**
* Verifies that get_posts() accepts a query string for the `$args` parameter.
*
* @ticket 64813
*/
public function test_should_accept_query_string_args() {
$p1 = self::factory()->post->create();
$p2 = self::factory()->post->create();

$found = get_posts( 'numberposts=1&fields=ids' );

$this->assertSame( array( $p2 ), $found );
}
}
Loading