Tribe__Tickets__Tickets::get_event_attendees_count( int $post_id, array $args = array() )

Returns the total number of attendees for an event (regardless of provider).


Parameters

$post_id

(int) (Required) ID of parent "event" post.

$args

(array) (Optional) List of arguments to filter attendees by.

  • 'by'
    (array) List of ORM->by() filters to use. [what=>[args...]], [what=>arg], or [[what,args...]] format.
  • 'where_multi'
    (array) List of ORM->where_multi() filters to use. [[what,args...]] format.

Default value: array()


Top ↑

Return

(int) Total count of attendees.


Top ↑

Source

File: src/Tribe/Tickets.php

		public static function get_event_attendees_count( $post_id, $args = [] ) {
			// Post ID is required.
			if ( empty( $post_id ) ) {
				return 0;
			}

			$provider = 'default';

			if ( ! empty( $args['provider'] ) ) {
				$provider = $args['provider'];
			}

			/** @var Tribe__Tickets__Attendee_Repository $repository */
			$repository = tribe_attendees( $provider );

			$repository->by( 'event', $post_id );

			self::pass_args_to_repository( $repository, $args );

			return $repository->found();
		}