\WP_Stager_Integration\Event::get_single_event_id(): int|null
\WP_Stager_Integration\Event::get_single_event_id(): int|nullDescription
Gets the event ID of the currently viewed event page.
Returns:
int|null The event ID, or null if not on a single event page.
Information
| File | class-event.php line 158 |
|---|
Full Code
/**
* Gets the event ID of the currently viewed event page.
*
* @return int|null The event ID, or null if not on a single event page.
*/
public static function get_single_event_id() {
// Bail if not on a single event page
if ( ! self::is_single_event() ) {
return null;
}
// Get data
$event_data = (array) (self::get_single_event_data() ?: array());
$event_id = (int) ($event_data[ 'id' ] ?? 0);
if ( ! $event_id ) {
return null;
}
return $event_id;
}💡 If you ever get stuck or have a question, please check our FAQs, our Free Integration Service, our paid Full Integration Service, or reach out to us!

Get WP Stager Integration
🎁 Limited offer: Use code WELCOME26 to get your first month for free!

