Blocks::is_community_event_post( WP_Post|int $event )
Checks the origin of the given event post or post ID.
Contents
Check to see if the specific post was created via Community Events.
Parameters
- $event
-
(WP_Post|int) (Required) The event post or post ID.
Return
(string|false) The value of the '_EventOrigin' post meta, or false if not found.
Source
File: src/Events_Community/Block_Conversion/Blocks.php
public function is_community_event_post( $event ): bool {
$post_id = ( $event instanceof WP_Post ) ? $event->ID : absint( $event );
// Fetch and return the '_EventOrigin' post meta.
$event_origin = get_post_meta( $post_id, '_EventOrigin', true );
return 'community-events' === $event_origin;
}
Changelog
| Version | Description |
|---|---|
| 4.10.17 | Introduced. |