A WordPress-centric search engine for devs and theme authors



setup_postdata ›

Since1.5.0
Deprecatedn/a
setup_postdata ( $post )
Parameters:
  • (WP_Post|object|int) $post WP_Post instance or Post ID/object.
    Required: Yes
Returns:
  • (bool) True when finished.
Defined at:
Codex:
Change Log:
  • 4.4.0

Set up global post data.



Source

function setup_postdata( $post ) {
	global $wp_query;

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

	return false;
}