Tribe__Tickets__Main::post_types()

Returns the supported post types for tickets

Contents


Return

(array<string>)


Top ↑

Source

File: src/Tribe/Main.php

	public function post_types() {
		$options = (array) get_option( Tribe__Main::OPTIONNAME, array() );

		// if the ticket-enabled-post-types index has never been set, default it to tribe_events
		if ( ! array_key_exists( 'ticket-enabled-post-types', $options ) ) {
			$defaults                             = array( 'tribe_events' );
			$options['ticket-enabled-post-types'] = $defaults;
			tribe_update_option( 'ticket-enabled-post-types', $defaults );
		}

		// Remove WooCommerce Product and EDD post types to prevent recursion fatal error on save.
		$filtered_post_types = array_diff( (array) $options['ticket-enabled-post-types'], [ 'product', 'download' ] );

		/**
		 * Filters the list of post types that support tickets
		 *
		 * @param array $post_types Array of post types
		 */
		return apply_filters( 'tribe_tickets_post_types', $filtered_post_types );
	}