Tribe__Tickets__Editor::current_post_supports_tickets( mixed $post_type = null )
Check if current admin page is post type tribe_events
Contents
Parameters
- $post_type
-
(mixed) (Optional)
Default value: null
Return
(bool)
Source
File: src/Tribe/Editor.php
public function current_post_supports_tickets( $post_type = null ) {
$post_types = $this->get_enabled_post_types();
if ( ! is_null( $post_type ) ) {
return in_array( $post_type, $post_types, true );
}
$is_valid_type = false;
$helper = Tribe__Admin__Helpers::instance();
foreach ( $this->get_enabled_post_types() as $type ) {
$is_valid_type = $helper->is_post_type_screen( $type );
if ( $is_valid_type ) {
break;
}
}
if ( ! $is_valid_type ) {
return false;
}
global $post_id;
/**
* Allows overriding the ability of a post to support tickets, as long as the post_type supports tickets.
*
* @since 5.5.0
*
* @param bool $can_have_tickets the post type slug
* @param int $post_id the post id
*/
return apply_filters( 'event_tickets_post_supports_tickets', true, $post_id );
}
Changelog
| Version | Description |
|---|---|
| 5.5.0 | renamed from current_type_support_tickets |
| 4.9 | Introduced. |