I have a WordPress site which uses the gravityform plugin. Under certain circumstances I would like to deactivate the plugin programmatically and have it both be deactivated in the front end and show as such in the admin panel. When I then activate it in the admin panel, I would like the changes to be reflected in the front end (i.e. it now works again).

I have tried to achieve this by calling deactivate_plugins which does seem to deactivate it on the front end and indeed is_plugin_active returns false. However if I look at the admin panel under plugins it still appears as active. If I click deactivate and then activate it again in the admin panel it still shows up as deactivated on the front end.

  • 1
    It sounds like you may be running into caching issues. If a plugin is successfully deactivated, it is inactive in both the front end and the back end. And when successfully activated, it's available in both front end and back end. Out of curiosity, why do you need to deactivate the plugin entirely? If you just need to prevent form submissions, you can close forms after a certain date or certain number of submissions.
    – WebElaine
    Commented Dec 12, 2022 at 14:24
  • Thanks, we have a little bit of a niche use case which depends on third party services for security purposes. We've decided that should those services be down for any reason than we should suspend the forms service entirely on the site. I'll take a look into what might be happening with the cache.
    – Michael
    Commented Dec 12, 2022 at 14:50


Your Answer

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

Browse other questions tagged or ask your own question.