0

How to hide deactivation link from all WordPress plugin page.

enter image description here

0

There is a filter called plugin_action_links that lets you do this.

function wpse253902_disable_plugin_deactivation ($actions, $plugin_file, $plugin_data, $context) {
  if (array_key_exists ('deactivate', $actions)) unset( $actions['deactivate'] ); 
  return $actions;
  }

There is even a filter plugin_action_links_{plugin_name} that lets you control the links on individual plugins. If you dive into it, you will find out that you can also use this to define your own links.

1

You could restrict the plugin menu to only certain user access levels like admin. You will still want the link to be available without making a code change in the backend. This article should help you if you want to go this route. Remove ability to access certain admin menus

0

First: Why would you want that?

If you run your wordpress install as a multisite/network, you can install plugins on the "root", and activate for network. I believe that will make the plugin deactivation inaccessible on any subsite you set up. I haven't had that need myself, but I suppose it is possible. Another way to do it is to control the users admin rights, like only giving your users the role of author.

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.