Is it possible to build logic to control the activation and deactivation of specific wordpress plugins , for example Activation/Deactivation triggered by time period?

thanks for knowledge sharing.

  • I removed the plugin recommendation part from your question since its off-topic.
    – RRikesh
    Commented Jul 27, 2016 at 10:52

1 Answer 1


Method 1

You can use activate_plugin() and deactivate_plugins() to activate/deactivate plugins programmatically.

If you want to control the time at which those actions happen, then you can use wp_schedule_event() too.

Method 2

I know you asked about PHP, but if you have WP-CLI installed on your server, you can also write a script that uses wp plugin activate and wp plugin deactivate. Finally, add a cron job to run your script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.