Tribe__Tickets__Tickets::set_tickets_query_args( int|WP_Post $post_id = null, string|null $context = null )

Set the Query args to fetch all the Tickets.


Parameters

$post_id

(int|WP_Post) (Optional) Build the args to query only for tickets related to this post ID.

Default value: null

$context

(string|null) (Optional) The context of the query.

Default value: null


Top ↑

Return

(Tribe__Repository__Interface)


Top ↑

Source

File: src/Tribe/Tickets.php

		public function set_tickets_query_args( $post_id = null ) {
			$repository = tribe_tickets( $this->orm_provider );
			$repository->by( 'event', $post_id );
			$repository->by( 'status', 'publish' );
			$repository->by( 'posts_per_page', -1 );
			$repository->order_by( 'menu_order' );
			$repository->order( 'ASC' );
			$default_args = $repository->get_query();


			/**
			 * Filters the query arguments that will be used to fetch tickets.
			 *
			 * @since 4.8
			 *
			 * @param array $args
			 */
			$vars = apply_filters( 'tribe_tickets_get_tickets_query_args', $default_args->query_vars );

			if ( $default_args->query_vars !== $vars ) {
				$repository->by_args( $vars );
			}

			return $repository;
		}

Top ↑

Changelog

Changelog
Version Description
5.8.0 Added the $context parameter.
5.5.2 Set default query args.
5.5.0 refactored to use the tickets ORM.
4.6 Introduced.