WP_Post::to_array()

Convert object to array.


Return Return

(array) Object as array.


Top ↑

Source Source

File: wp-includes/class-wp-post.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;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

Top ↑

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