'product', 'post_status' => 'any', 'fields' => 'ids', 'numberposts' => -1, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Cleanup targets only this plugin's internal carrier marker. 'meta_key' => '_3dl_cc_free_placeholder', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value -- Cleanup targets only this plugin's internal carrier marker. 'meta_value' => 'yes', ]); foreach ($ids as $id) { wp_delete_post((int) $id, true); } } }; if (is_multisite()) { $threedl_cc_free_site_ids = get_sites(['fields' => 'ids', 'number' => 0]); foreach ($threedl_cc_free_site_ids as $threedl_cc_free_site_id) { switch_to_blog((int) $threedl_cc_free_site_id); $threedl_cc_free_delete_current_site(); restore_current_blog(); } } else { $threedl_cc_free_delete_current_site(); }