WP_Post::to_array

Advertisement

Summery Summery

Convert object to array.

Syntax Syntax

WP_Post::to_array()

Return Return

(array) Object as array.

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

Advertisement

Changelog Changelog

Changelog
Version Description
3.5.0 Introduced.

Advertisement

Leave a Reply