WordPress at a glance
function is not described

WP_Post::to_array() public WP 3.5.0

Convert object to array.

{} It's a 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.

Code of WP_Post::to_array() WP 5.7.2

<?php
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;
}