wp_get_single_post()

You are here:

wp_get_single_post( int $postidstring $mode = OBJECT )

Retrieve a single post, based on post ID.

Description Description

Has categories in ‘post_category’ property or key. Has tags in ‘tags_input’ property or key.

See also See also

  • get_post()

Top ↑

Parameters Parameters

$postid

(int) (Required) Post ID.

$mode

(string) (Optional) How to return result, either OBJECT, ARRAY_N, or ARRAY_A.

Default value: OBJECT


Top ↑

Return Return

(WP_Post|null) Post object or array holding post contents and information


Top ↑

Source Source

File: wp-includes/deprecated.php

3287
3288
3289
3290
function wp_get_single_post( $postid = 0, $mode = OBJECT ) {
    _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
    return get_post( $postid, $mode );
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.5.0 Use get_post()
1.0.0 Introduced.
Was this article helpful?
Dislike 0
Views: 15