robotstxt-mlp2-mlp5/uninstall.php
2026-03-02 11:22:59 +00:00

24 lines
784 B
PHP

<?php
/**
* Plugin uninstall handler.
*
* Executed when the plugin is deleted from the WordPress admin.
* By default, all plugin data is preserved on uninstall. Users can opt in
* to data deletion via the plugin settings screen (network option
* `mlp_migrator_delete_on_uninstall`, default: false).
*
* @package Robotstxt_Mlp2_Mlp5
*/
if ( ! defined( 'ABSPATH' ) || ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
require_once __DIR__ . '/includes/class-robotstxt-mlp2-mlp5-logger.php';
// Only delete data when the user has explicitly opted in.
if ( get_site_option( 'mlp_migrator_delete_on_uninstall', false ) ) {
Robotstxt_Mlp2_Mlp5_Logger::drop_table();
delete_site_option( 'mlp_migrator_delete_on_uninstall' );
delete_site_option( 'mlp_migrator_wizard_state' );
}