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



generate_postdata ›

Since5.2.0
已弃用n/a
generate_postdata ( $post )
参数:
  • (WP_Post|object|int) $post WP_Post instance or Post ID/object.
    Required: Yes
返回:
  • (array|bool) Elements of post, or false on failure.
定义在:
文档:

Generates post data.



源码

function generate_postdata( $post ) {
	global $wp_query;

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

	return false;
}