RecurrenceMeta::recurrence_get_start_dates( null|array $occurrences, int $post_id )

Will fetch the occurrence dates for the post specified.


Parameters

$occurrences

(null|array) (Required) The results if any have been filtered.

$post_id

(int) (Required) The post ID to fetch occurrences for.


Top ↑

Return

(string[]) The occurrence dates found.


Top ↑

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' );
	}

Top ↑

Changelog

Changelog
Version Description
6.3.0 Introduced.