0

I've looked at other posts regarding mu-plugins but I don't understand yet. Here's the situation: My site is hosted by a service that automatically set up 2 caching plugins. Cloudflare and OP Cache. They were originally installed in the mu-plugins folder. I'm not sure what happened, as there are multiple people working on this site, but they all disappeared.

I reinstalled them but can't activate them. I got the error

Fatal error: Cannot redeclare class OPcache_dashboard in oursite/www/wp-content/plugins/opcache/opcache.php on line 28

So I guess when I reinstalled, it put them in the normal plugins folder. If I delete the mu-plugins version, I can then activate it. However, what I'd like to do is keep them in the mu-plugins folder and activate them from there, but they don't appear unless they're in the normal plugins folder.

Any thoughts?

Thanks in advance!

  • Must-use plugins are not in same list with normal plugins, there's a separate tab in plugin page. You cannot enable/disable must-use plugins, they are enabled by default and cannot be disabled! Are you sure you looked the right tab? Are you sure they are not working? Double check please. Also, this is very fishy setup in my opinion.. 3rd party plugins shouldn't be must-use because updates might break your site and you can't disable them.. It's not the best idea to depend on 3rd party plugins. – N00b May 2 '16 at 8:07
  • Additional note: if your host enforces must-use plugins, there's a chance that they might have enforced custom rules or code. If that's the case, this problem is out of our scope and you should contact your host. – N00b May 2 '16 at 8:17
  • Thanks so much for your response. I would definitely prefer having them in their original form as "mu-plugins" that work correctly. The reason I'm installing them as 3rd party plugins is because I'm having trouble getting a hold of the hosting company. The person who hired me is connected with them and I can't get a hold of him. I do see your point though. If they're custom, then we should be using them. But you answered my question. They're not interchangeable like I thought and can't just be swapped in and out of folders like that. Thanks! – Kevmon May 2 '16 at 8:23
0

Where that error comes from is hard to say. Obviously something needs that class, but it hasn't been included/autoloaded.

If the plugins you mentioned are designed to be in the mu plugins folder, then you should obviously place them there.

MU plugins behave a bit differently as Twerking N00b hinted at and must have an init file in the ROOT of the mu-folder (unlike normal plugins). The structure you should aim for is one init file per mu-plugin, and then the folder with the actual plugin code. The only thing the init file does, is one line with an "include", that includes the main plugin file.

  • Thanks DarkNeuron, I'm working on getting a hold of the hosting company and having them fix it because I'm realizing I can't and probably shouldn't try to fix it myself. Thanks for the info! – Kevmon May 4 '16 at 3:48
  • No problem. If you are satisfied with my answer, you can mark it as such. Thanks in return. – DarkNeuron May 4 '16 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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