Post_Thumbnail::exists()

Returns whether a post thumbnail is set for the post or not.


Return

(bool) Whether a post thumbnail is set for the post or not.


Top ↑

Source

File: src/Tribe/Utils/Post_Thumbnail.php

	public function exists() {
		if ( null !== $this->exists ) {
			return $this->exists;
		}

		$thumbnail_id = get_post_thumbnail_id( $this->post_id );

		if ( empty( $thumbnail_id ) ) {
			$this->exists = false;
		} else {
			$this->thumbnail_id = $thumbnail_id;
			$this->exists       = true;
		}

		return $this->exists;
	}

Top ↑

Changelog

Changelog
Version Description
4.9.16 Introduced.