RecurrenceMeta::recurrence_get_start_dates( null|array $occurrences, int $post_id )
Will fetch the occurrence dates for the post specified.
Contents
Parameters
- $occurrences
-
(null|array) (Required) The results if any have been filtered.
- $post_id
-
(int) (Required) The post ID to fetch occurrences for.
Return
(string[]) The occurrence dates found.
Source
File: src/Events_Pro/Custom_Tables/V1/Legacy_Compat/RecurrenceMeta.php
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. |