prefix . $table ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Intentional schema removal during plugin uninstallation, table name is escaped $wpdb->query( "DROP TABLE IF EXISTS {$table_name}" ); } } /** * Clear all AdminEase scheduled cron events. * * Hook names must match those scheduled in includes/Features/NetworkViewer.php, * EmailLog.php and CronViewerLog.php, and cleared in the adminease.php * deactivation hook. */ function adminease_clear_cron_events(): void { $hooks = [ 'adminease_cleanup_network_viewer_logs', 'adminease_cleanup_email_logs', 'adminease_cleanup_cron_viewer_logs', ]; foreach ( $hooks as $hook ) { wp_clear_scheduled_hook( $hook ); } } /** * Optional: Delete plugin options. * * By design, plugin settings are PRESERVED across uninstall so that a user who * deletes-then-reinstalls AdminEase does not lose configuration. This matches * the behavior documented in DOCUMENTATION.md ("Deactivation Behavior" / * "Uninstallation"). Do NOT enable the call to this function below without * also updating the documentation. */ function adminease_delete_plugin_options() { delete_option( 'adminease_settings' ); delete_option( 'adminease_activation_status' ); delete_option( 'adminease_activation_errors' ); delete_option( 'adminease_deactivation_status' ); delete_option( 'adminease_deactivation_errors' ); delete_option( 'adminease_backup_dir_notice' ); } // Execute cleanup operations adminease_drop_tables(); adminease_clear_cron_events(); // Optionally delete plugin options (uncomment the line below to enable) // adminease_delete_plugin_options();