'outercite_suggestion', 'post_status' => 'any', 'posts_per_page' => -1, 'fields' => 'ids', ) ); foreach ( $suggestions as $id ) { wp_delete_post( (int) $id, true ); } global $wpdb; foreach ( array( 'outercite_weekly_email', 'outercite_new_seen_at' ) as $key ) { delete_metadata( 'user', 0, $wpdb->get_blog_prefix() . $key, '', true ); } // Locks left by a draft poll that died. $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like( 'outercite_writing_' ) . '%' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- uninstall only, no API for a prefix. remove_role( 'outercite_client' ); foreach ( array( 'outercite_retry_mark_live', 'outercite_check_new_changes', 'outercite_weekly_email' ) as $hook ) { // wp_unschedule_hook() also removes events scheduled with arguments (the retries). wp_unschedule_hook( $hook ); } } if ( is_multisite() ) { foreach ( get_sites( array( 'fields' => 'ids', 'number' => 0, ) ) as $outercite_site_id ) { switch_to_blog( (int) $outercite_site_id ); outercite_uninstall_site(); restore_current_blog(); } } else { outercite_uninstall_site(); }