Last active
March 21, 2019 14:44
-
-
Save zackkatz/07ddc2717d9ccfd74cca to your computer and use it in GitHub Desktop.
Functions to get plugin activation and deactivation links
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 | |
/** | |
* Get the Activation URL for a plugin | |
* @param string $plugin_path Directory and file name of plugin, like: `hello-dolly/hello.php` | |
* @return string URL to activate the plugin | |
*/ | |
function get_plugin_activation_link( $plugin_path = 'hello-dolly/hello.php' ) { | |
return wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$plugin_path), 'activate-plugin_'.$plugin_path); | |
} | |
/** | |
* Get the De-Activation URL for a plugin | |
* @param string $plugin_path Directory and file name of plugin, like: `hello-dolly/hello.php` | |
* @return string URL to de-activate the plugin | |
*/ | |
function get_plugin_deactivation_link( $plugin_path = 'hello-dolly/hello.php' ) { | |
return wp_nonce_url(admin_url('plugins.php?action=deactivate&plugin='.$plugin_path), 'deactivate-plugin_'.$plugin_path); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment