Disable Comments
[resolved] Plugin forgets its settings when disabled & re-eneabled (5 posts)

  1. GermanKiwi
    Posted 3 years ago #

    Hi solarissmoke,

    I've noticed that if I disable this plugin, and then re-enable it again, it "forgets" the settings which I had previously given it, and it reverts back to its default settings.

    Eg. if I had changed its setting to "Everywhere", then I disable and re-enable the plugin, the setting will then be changed back to "On certain post types" instead of "Everywhere".

    In other words, it doesn't remember its settings after it's disabled. I think it should, however, because I think this is normal practice for plugins - every other plugin I use will remember its settings when it is disabled and re-enabled.

    Could you arrange for this plugin to also remember its settings this way?

    Thanks! :)


  2. Samir Shah
    Plugin Author

    Posted 3 years ago #


    Unfortunately it's not so easy ;-). I guess you are using the plugin on a multi-site installation of WordPress. Here's the problem:

    On single-site installations, the plugin remembers your settings after you disable it (just what you want). If you completely uninstall it from the Plugin admin page, then WordPress runs the plugin's uninstall script, which deletes all the settings from the database.

    But on multi-site installations, WordPress handles things differently. It never runs an uninstall script. So there are two options: (1) leave the settings in the database forever (this is what most plugins that were written with only single-site in mind do - and why people then have to clean up their database using yet another plugin like this one) or (2) delete the settings when the plugin is disabled. I went for option (2) because I hate database bloat and don't want to contribute to it.

    Hopefully this explains the problem. It should only be happening on multi-site installations. On single-site WordPress it works exactly as you want.

  3. GermanKiwi
    Posted 3 years ago #

    Thanks, that's helpful to know! BUT I have to throw a spanner in the works - I am actually running on a single site, not multisite!! :)

    I've just tested this issue again using version 1.0 which I upgraded to last night, and it's definitely not remembering the settings after I disable and re-enable the plugin. It reverts the settings back to "On certain post types" although I had it saved as "Everywhere" previously.

    Are you able to test and double-check that it's truly remembering the settings? (Eg. if you save it to "Everywhere" and then disable/re-enable)


  4. Samir Shah
    Plugin Author

    Posted 3 years ago #

    Thanks for persisting... I had a good look at the code and found a flaw in the logic. I've just pushed an update (version 1.0.1) and it should work now!

  5. GermanKiwi
    Posted 3 years ago #

    Awesome, thanks! I've just upgraded to 1.0.1 and I can confirm it works now - the settings are remembered! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Disable Comments
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.