$now, 'attempts' => gmdate( 'Y-m-d H:i:s', time() - DAY_IN_SECONDS ), 'message_log' => gmdate( 'Y-m-d H:i:s', time() - 90 * DAY_IN_SECONDS ), ); foreach ( $jobs as $short => $cutoff ) { $table = esc_sql( Schema::table( $short ) ); $col = 'otp_codes' === $short ? 'expires_at' : 'created_at'; $wpdb->query( $wpdb->prepare( "DELETE FROM `{$table}` WHERE {$col} < %s", $cutoff ) ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,PluginCheck.Security.DirectDB.UnescapedDBParameter -- Table and column names are fixed internal values. } // phpcs:enable Audit_Log::purge_expired(); } }