WordPress开发者和主题制作者的搜索引擎



setup_postdata ›

Since1.5.0
已弃用n/a
setup_postdata ( $post )
参数:
  • (WP_Post|object|int) $post WP_Post instance or Post ID/object.
    Required: Yes
返回:
  • (bool) True when finished.
定义在:
文档:
Change Log:
  • 4.4.0

Set up global post data.



源码

function setup_postdata( $post ) {
	global $wp_query;

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

	return false;
}