RecurrenceMeta
Class RecurrenceMeta
Source
File: src/Events_Pro/Custom_Tables/V1/Legacy_Compat/RecurrenceMeta.php
class RecurrenceMeta {
/**
* Will fetch the occurrence dates for the post specified.
*
* @since TBD
*
* @param null|array $occurrences The results if any have been filtered.
* @param int $post_id The post ID to fetch occurrences for.
*
* @return string[] The occurrence dates found.
*/
public function recurrence_get_start_dates( $occurrences, $post_id ): array {
/**
* @var wpdb $wpdb
*/
global $wpdb;
$occurrences = Occurrence::where( 'post_id', $post_id )
->join( $wpdb->posts, 'ID', 'post_id' )
->where_raw( 'post_status NOT IN(%s,%s,%s)', [ 'inherit', 'auto-draft', 'trash' ] )
->order_by( 'start_date', 'ASC' )
->get();
if ( ! is_array( $occurrences ) ) {
$occurrences = [];
}
return wp_list_pluck( $occurrences, 'start_date' );
}
}
Changelog
| Version | Description |
|---|---|
| 6.3.0 | Introduced. |
Methods
- recurrence_get_start_dates — Will fetch the occurrence dates for the post specified.