WPDev.one
Core Function
View Source on Trac ↗

wp_get_recent_posts()

wp_get_recent_posts( mixed $args = array(), mixed $output = ARRAY_A )

Retrieves a number of recent posts.

Parameters 1 required

Name / Type Description
$args
array

Optional. Arguments to retrieve posts. Default empty array.

string

$output Optional. The required return type. One of OBJECT or ARRAY_A, which correspond to a WP_Post object or an associative array, respectively. Default ARRAY_A.

Required

Return Value

((array)
(array | false) Array of recent posts, where the type of each element is determined by the `$output` parameter. Empty array on failure.

Function Information

Since Version
1.0.0
Source File
wp-includes/post.php
Advertisement