Generate activation or deactivation link of WordPress plugin

Sometimes you need an action link to activate or deactivate a plugin. How do you do that?
I have written a simple function that can help you achieve this.

How to use?
This function requires 2 parameters; first one is the plugin file name, and second one is action type.
Plugin file name is the base file resides in wp-content/plugins directory. If you have a plugin called My Super Plugin and the base file is wp-content/plugins/my-super-plugin/my-super-plugin.php, then the file name will be my-super-plugin/my-super-plugin.php

And second parameter is the action type, either activate or deactivate.

So, if you want to activate My Super Plugin, you have to write-

And to deactivate-


WPpeople works mainly on WordPress based projects.
It specializes in developing Plugins, Themes and WP based apps. Well, you can count SEO and maintenance jobs too.

Get in touch