prefix . 'threecal_events', $wpdb->prefix . 'threecal_locations', $wpdb->prefix . 'threecal_categories', $wpdb->prefix . 'threecal_event_categories', $wpdb->prefix . 'threecal_subscribers', ); foreach ( $threecal_tables as $threecal_table ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is internally generated, not user input. $wpdb->query( "DROP TABLE IF EXISTS $threecal_table" ); } // Delete options. delete_option( 'threecal_settings' ); delete_option( 'threecal_db_version' ); delete_option( 'threecal_post_dates' ); delete_option( 'threecal_no_schema_categories' ); // Dates stored in posts. foreach ( array( '_threecal_show', '_threecal_start', '_threecal_end', '_threecal_all_day', '_threecal_event_id', '_threecal_sort' ) as $threecal_meta_key ) { delete_post_meta_by_key( $threecal_meta_key ); } // Delete transients. delete_transient( 'threecal_activated' ); // Remove capabilities. $threecal_roles = array( 'administrator', 'editor' ); $threecal_caps = array( 'manage_threecal', 'create_threecal_events', 'edit_threecal_events', 'delete_threecal_events', 'manage_threecal_locations', 'manage_threecal_categories', 'threecal_settings', ); foreach ( $threecal_roles as $threecal_role_name ) { $threecal_role = get_role( $threecal_role_name ); if ( $threecal_role ) { foreach ( $threecal_caps as $threecal_cap ) { $threecal_role->remove_cap( $threecal_cap ); } } } // Clear scheduled hooks. wp_clear_scheduled_hook( 'threecal_daily_notifications' ); wp_clear_scheduled_hook( 'threecal_cleanup_expired' ); }