Process_Worker_Service::remove_series()
Before we finalize a cancellation/undo worker, let’s do our Pro specific cleanup. We need to remove Series posts and related data to avoid orphans.
Source
File: src/Events_Pro/Custom_Tables/V1/Migration/Process_Worker_Service.php
public function remove_series(): void {
global $wpdb;
$query = "DELETE {$wpdb->posts}, {$wpdb->postmeta}
FROM {$wpdb->postmeta}
INNER JOIN {$wpdb->posts} ON {$wpdb->postmeta}.post_id = {$wpdb->posts}.ID
WHERE {$wpdb->posts}.post_type = %s";
$wpdb->query( $wpdb->prepare( $query, Post_Type::POSTTYPE ) );
// Remove any leftover Series posts in cache.
wp_cache_flush();
}
Changelog
| Version | Description |
|---|---|
| 6.0.0 | Introduced. |