posts} p JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id WHERE post_type = 'scheduled-action' AND post_status = 'pending' AND post_title LIKE 'wc-admin_%'"; // phpcs:ignore WordPress.DB.PreparedSQL $wpdb->query( $delete_pending_sql ); // Delete all taxonomy data related to the WC Admin scheduled action group. $group_term = get_term_by( 'slug', WC_Admin_Reports_Sync::QUEUE_GROUP, parent::GROUP_TAXONOMY ); if ( $group_term ) { $wpdb->delete( $wpdb->term_relationships, array( 'term_taxonomy_id' => $group_term->term_taxonomy_id ), array( '%d' ) ); $wpdb->delete( $wpdb->term_taxonomy, array( 'term_id' => $group_term->term_id ), array( '%d' ) ); $wpdb->delete( $wpdb->terms, array( 'term_id' => $group_term->term_id ), array( '%d' ) ); clean_taxonomy_cache( parent::GROUP_TAXONOMY ); } } }