Settings first if you do want a full wipe. */ defined( 'WP_UNINSTALL_PLUGIN' ) || exit; // Always revoke the capabilities granted on activation (class-followly-install.php // is self-contained — no other plugin files are touched by requiring it). require_once __DIR__ . '/includes/class-followly-install.php'; Followly_Install::revoke_capabilities(); if ( '1' !== get_option( 'followly_delete_data_on_uninstall' ) ) { return; } global $wpdb; $followly_automation_ids = get_posts( array( 'post_type' => 'followly_automation', 'post_status' => 'any', 'posts_per_page' => -1, 'fields' => 'ids', ) ); foreach ( $followly_automation_ids as $followly_id ) { wp_delete_post( $followly_id, true ); } $wpdb->query( $wpdb->prepare( 'DROP TABLE IF EXISTS %i', $wpdb->prefix . 'followly_log' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange -- Removing the plugin's own table on uninstall, only when the user opted in. delete_option( 'followly_log_table_version' ); delete_option( 'followly_delete_data_on_uninstall' ); delete_option( 'followly_log_retention_days' ); delete_option( 'followly_migrated_from_kwa' ); wp_clear_scheduled_hook( 'followly_daily_cleanup' );