generate_postdata() WordPress Function
The generate_postdata() function is used to generate an array of data for a new post. This array can then be used with the wp_insert_post() function to create a new post.
generate_postdata( WP_Post|object|int $post ) #
Generates post data.
Parameters
Return
(array|false) Elements of post, or false on failure.
Source
File: wp-includes/query.php
function generate_postdata( $post ) { global $wp_query; if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) { return $wp_query->generate_postdata( $post ); } return false; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.2.0 | Introduced. |