Base::from_post( WP_Post|int $post )

Builds, and returns, a post type model from a given post.


Parameters

$post

(WP_Post|int) (Required) The post ID or post object.


Top ↑

Return

(TribeModelsPost_TypesBase|TribeModelsPost_TypesNothing) Either the built Post Type model, or a Nothing model if the post does not exist.


Top ↑

Source

File: src/Tribe/Models/Post_Types/Base.php

	public static function from_post( $post ) {
		$post = get_post( $post );

		if ( ! $post instanceof \WP_Post ) {
			return new Nothing();
		}

		$instance       = new static;
		$instance->post = $post;

		return $instance;
	}

Top ↑

Changelog

Changelog
Version Description
4.9.18 Introduced.