generate_postdata( WP_Post|object|int $post ): array|false

In this article

Generates post data.

Parameters

$postWP_Post|object|intrequired
WP_Post instance or Post ID/object.

Return

array|false Elements of post, or false on failure.

Source

function generate_postdata( $post ) {
	global $wp_query;

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

	return false;
}

Changelog

VersionDescription
5.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.