WP_Post::to_array(): array

In this article

Convert object to array.

Return

array Object as array.

Source

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

Changelog

VersionDescription
3.5.0Introduced.

User Contributed Notes

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