I don't want clients to deactivate woocommerce plugin even by mistake. And I have recently come across a concept called must use plugins in wordpress. (http://codex.wordpress.org/Must_Use_Plugins)

Just want to know if there is possibility to use woocommerce as a must use plugin.


3 Answers 3


This is a classic XY problem question, the original problem you face is:

"How do I prevent a client from disabling the woocommerce plugin"

For which mu-plugins was your solution, to which you are now asking for a fix for your solution, aka a fix for a fix, never a good sign.

So addressing your original problem we have three approaches:

Fail gracefully and make it clear how to fix things

If WooCommerce is disabled, warn the user that it has been disabled, fail gracefully, and put links to the reactivation button here there and everywhere. The client should very quickly get the message that what they did will break the site

Disable the disable link

e.g. for the facebook open graph plugin:


add_filter( 'plugin_action_links', 'disable_plugin_deactivation', 10, 4 );
function disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) {
    // Remove edit link for all
    if ( array_key_exists( 'edit', $actions ) )
        unset( $actions['edit'] );
    // Remove deactivate link for crucial plugins
    if ( array_key_exists( 'deactivate', $actions ) && in_array( $plugin_file, array(
        unset( $actions['deactivate'] );
    return $actions;

Disable The Plugin Menu Itself

The client can't disable a plugin if they cant see the plugins page:

function remove_menus () {
    global $menu;
    $restricted = array( __('Plugins') );
    end ($menu);
    while (prev($menu)){
        $value = explode(' ',$menu[key($menu)][0]);
        if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
add_action('admin_menu', 'remove_menus');

I would recommend both failing gracefully, and disabling the plugins menu. Fail gracefully and your code will be more robust, and robust code is profitable code ( those hours you saved turn into days worth of painful support and mysterious bugs ). A client won't know you can disable a plugin if they're unaware there is a plugin menu to begin with.


I don't think it would be a good idea.

There are some limitations with mu-plugins:

  1. You won't get notifications for automatic updates
  2. Plugin activation hooks are not executed. In other words, any setup operation that the plugin uses when you activate them won't be triggered
  3. WordPress won't find functions declared in subfolders of the mu-plugins folder

A better way will be give not to give the activate_plugins capability to your client.

  • 1. I am responsible for handling updates - I will do it myself. 2. What if I activate the plugin normally and then move the whole directory to the mu-plugins folder. 3. a simple loader file will help in solving that. Mar 25, 2013 at 17:23
  • It will be more work for you. What if you gave your client an editor account? He won't get access to the plugin menu.
    – RRikesh
    Mar 25, 2013 at 17:55

Must-use plugins (a.k.a. mu-plugins) are plugins installed in a special directory inside the content folder and which are automatically enabled on all sites in the installation.

Must-use plugins do not show in the Plugins page of wp-admin and cannot be disabled except by removing the plugin file from the must-use directory, which is found in wp-content/mu-plugins by default.


Always-on, no need to enable via admin and users cannot disable by accident.
Can be enabled simply by uploading file to the mu-plugins directory, without having to log-in.


  • This should answer your question.
    – Androliyah
    Mar 25, 2013 at 10:29
  • The Question is not "what is a mu plugin". And they do show in the Plugins page (in its own tab).
    – brasofilo
    Mar 25, 2013 at 11:28
  • @brasofilo are you debating with ME or the WordPress codex?
    – Androliyah
    Mar 25, 2013 at 16:38
  • As noted above by Tom J Nowell, mu-plugins is the original solution to the original problem, -- "Just want to know if there is possibility to use woocommerce as a must use plugin." -- so why was I downvoted twice for my answer? purely rhetorical
    – Androliyah
    Mar 26, 2013 at 5:27

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.