WP_Post::to_array()
Convert object to array.
Method of the class: WP_Post{}
No Hooks.
Return
Array
. Object as array.
Usage
$WP_Post = new WP_Post(); $WP_Post->to_array();
Changelog
Since 3.5.0 | Introduced. |
WP_Post::to_array() WP Post::to array code WP 6.2.2
public function to_array() { $post = get_object_vars( $this ); foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) { if ( $this->__isset( $key ) ) { $post[ $key ] = $this->__get( $key ); } } return $post; }