Skip to content

Instantly share code, notes, and snippets.

@sybrew
Last active December 6, 2017 23:17
Show Gist options
  • Save sybrew/2e7747f49869dbcd9c97e4faba57e607 to your computer and use it in GitHub Desktop.
Save sybrew/2e7747f49869dbcd9c97e4faba57e607 to your computer and use it in GitHub Desktop.
Removes TSF testing settings.
<?php
/**
* Plugin Name: Reset TSF testing settings
* Plugin URI: https://theseoframework.com/
* Description: Activate this plugin to remove TSF testing settings.
* Author: Sybre Waaijer
* Version: 1.0.0
* Author URI: https://cyberwire.nl/
*/
defined( 'ABSPATH' ) and add_action( 'admin_init', function() {
new TSF_Reset;
} );
class TSF_Reset {
private $success;
function __construct() {
$this->success = delete_option( 'the_seo_framework_tested_upgrade_version' );
$this->success = $this->success && delete_option( 'the_seo_framework_upgraded_db_version' );
register_deactivation_hook( __FILE__, array( $this, 'register_notices' ) );
deactivate_plugins( plugin_basename( __FILE__ ) );
}
function register_notices() {
add_action( 'admin_notices', array( $this, 'output_notices' ) );
}
function output_notices() {
printf( '<div class="notice updated"><p>%s</p><p>%s</p><p>%s</p></div>',
$this->success ? 'Successfully removed TSF testing settings.' : 'TSF testing settings have already been removed.',
'"Reset TSF testing settings" has been deactivated instantly.',
'You can safely remove plugin <strong>"Reset TSF testing settings"</strong>.'
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment