Tribe__Tickets__Tickets::get_tickets_ids( int|WP_Post $post,  $context = null )

Retrieve the ID numbers of all tickets assigned to an event.


Parameters

$post

(int|WP_Post) (Required) Only get tickets assigned to this post ID.


Top ↑

Return

(array|false)


Top ↑

Source

File: src/Tribe/Tickets.php

		public function get_tickets_ids( $post = null ) {
			if ( ! empty( $post ) ) {
				if ( ! $post instanceof WP_Post ) {
					$post = get_post( $post );
				}
				if ( ! $post instanceof WP_Post ) {
					return false;
				}
				$args = $this->get_tickets_query_args( $post->ID );
			} else {
				$args = $this->get_tickets_query_args();
			}

			$cache = new Tribe__Cache();
			$cache_key = $cache->make_key( $args );
			$query = $cache->get( $cache_key );

			if ( $query instanceof WP_Query ) {
				return $query->posts;
			}

			$query = new WP_Query( $args );
			$cache->set( $cache_key, $query, Tribe__Cache::NO_EXPIRATION );

			return $query->posts;
		}

Top ↑

Changelog

Changelog
Version Description
5.8.0 Added the $context parameter.
5.5.0 refactored to use the tickets ORM.
4.6 Introduced.