setup_postdata

Advertisement

Summery Summery

Set up global post data.

Syntax Syntax

setup_postdata( WP_Post|object|int $post )

Parameters Parameters

$post

(Required) WP_Post instance or Post ID/object.

Return Return

(bool) True when finished.

Source Source

File: wp-includes/query.php

 */
function setup_postdata( $post ) {
	global $wp_query;

	if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) {
		return $wp_query->setup_postdata( $post );
	}

	return false;

Advertisement

Changelog Changelog

Changelog
Version Description
4.4.0 Added the ability to pass a post ID to $post.
1.5.0 Introduced.

Advertisement

Leave a Reply