Created
November 13, 2017 10:42
-
-
Save sybrew/c9a9e8b0900f36cf597210372e53c75d to your computer and use it in GitHub Desktop.
Deletes TSFEM activation settings.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Reset TSFEM activation settings | |
* Plugin URI: https://theseoframework.com/ | |
* Description: Activate this plugin to remove TSF - Extension Manager activation settings. | |
* Author: Sybre Waaijer | |
* Version: 1.0.0 | |
* Author URI: https://cyberwire.nl/ | |
*/ | |
defined( 'ABSPATH' ) and add_action( 'admin_init', function() { | |
$success = false; | |
if ( defined( 'TSF_EXTENSION_MANAGER_SITE_OPTIONS' ) && TSF_EXTENSION_MANAGER_SITE_OPTIONS ) { | |
$success = delete_option( TSF_EXTENSION_MANAGER_SITE_OPTIONS ); | |
} else { | |
$success = delete_option( 'tsf-extension-manager-settings' ); | |
} | |
register_deactivation_hook( __FILE__, function() use ( $success ) { | |
add_action( 'admin_notices', function() use ( $success ) { | |
printf( '<div class="notice updated"><p>%s</p><p>%s</p><p>%s</p></div>', | |
$success ? 'Successfully removed TSFEM activation settings.' : 'TSFEM activation settings have already been removed.', | |
'"Reset TSFEM activation settings" has been deactivated instantly.', | |
'You can safely remove plugin <strong>"Reset TSFEM activation settings"</strong>.' | |
); | |
} ); | |
} ); | |
deactivate_plugins( plugin_basename( __FILE__ ) ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment