diff --git a/includes/core/classes/class-event.php b/includes/core/classes/class-event.php index b2d577e40..7639a88be 100644 --- a/includes/core/classes/class-event.php +++ b/includes/core/classes/class-event.php @@ -63,7 +63,6 @@ class Event { */ const TAXONOMY = 'gp_topic'; - /** * Event post object. * @@ -567,14 +566,14 @@ public function get_datetime(): array { } $cache_key = sprintf( self::DATETIME_CACHE_KEY, $this->event->ID ); - $data = wp_cache_get( $cache_key ); + $data = get_transient( $cache_key ); if ( empty( $data ) || ! is_array( $data ) ) { $table = sprintf( static::TABLE_FORMAT, $wpdb->prefix ); - $data = (array) $wpdb->get_results( $wpdb->prepare( 'SELECT datetime_start, datetime_start_gmt, datetime_end, datetime_end_gmt, timezone FROM ' . esc_sql( $table ) . ' WHERE post_id = %d LIMIT 1', $this->event->ID ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery + $data = (array) $wpdb->get_results( $wpdb->prepare( 'SELECT datetime_start, datetime_start_gmt, datetime_end, datetime_end_gmt, timezone FROM ' . esc_sql( $table ) . ' WHERE post_id = %d LIMIT 1', $this->event->ID ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $data = ( ! empty( $data ) ) ? (array) current( $data ) : array(); - wp_cache_set( $cache_key, $data, 15 * MINUTE_IN_SECONDS ); + set_transient( $cache_key, $data, 15 * MINUTE_IN_SECONDS ); } return array_merge( @@ -913,12 +912,12 @@ function ( $key ) { ); if ( ! empty( $exists ) ) { - $retval = $wpdb->update( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery + $retval = $wpdb->update( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $table, $fields, array( 'post_id' => $fields['post_id'] ) ); - wp_cache_delete( sprintf( self::DATETIME_CACHE_KEY, $fields['post_id'] ) ); + delete_transient( sprintf( self::DATETIME_CACHE_KEY, $fields['post_id'] ) ); } else { $retval = $wpdb->insert( $table, $fields ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery }