\WP_Stager_Integration\Event::filter_event_date(string|int $date, string $format, WP_Post $post): string|int|false
\WP_Stager_Integration\Event::filter_event_date(string|int $date, string $format, WP_Post $post): string|int|falseDescription
Filters the event date.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$date | string|int | Formatted date string or Unix timestamp if $format is 'U' or 'G'. |
$format | string | PHP date format. |
$post | WP_Post | The post object. |
Returns:
string|int|false Date the current post was written. False on failure.
Information
| File | class-event.php line 1110 |
|---|
Full Code
/**
* Filters the event date.
*
* @param string|int $date Formatted date string or Unix timestamp if $format is 'U' or 'G'.
* @param string $format PHP date format.
* @param WP_Post $post The post object.
*
* @return string|int|false Date the current post was written. False on failure.
*/
public static function filter_event_date( $date, $format, $post ) {
// Bail if not an event post
if ( $post->post_type !== self::CPT_SLUG ) {
return $date;
}
// Get programStartAt meta
$meta_key = (string) (self::get_meta_key( self::META_KEY_TIMESTAMP_PROGRAM_START ) ?: '');
$program_start_at = (int) (get_post_meta( $post->ID, $meta_key, true ) ?: 0);
// Bail if no programStartAt meta
if ( ! $program_start_at ) {
return $date;
}
// Format date
return wp_date( $format, $program_start_at );
}💡 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!

