Remove Plugin_action_links From Plugin List

8 min read Oct 12, 2024
Remove Plugin_action_links From Plugin List

How to Remove Plugin Action Links from the Plugin List in WordPress

Are you tired of seeing those extra action links cluttering up your WordPress plugin list? Maybe you want a cleaner look or simply want to streamline your plugin management. Whatever your reason, removing those links can be easily accomplished with a few simple steps.

Understanding Plugin Action Links

Before we dive into the how-to, let's first understand what these action links are and why they're there. These links, typically displayed next to each plugin in the "Plugins" page of your WordPress admin area, provide quick access to various plugin actions like:

  • Edit: Allows you to configure plugin settings.
  • Deactivate: Temporarily disables the plugin.
  • Delete: Permanently removes the plugin from your site.
  • View details: Opens the plugin's information page on WordPress.org.

While these links provide convenience, they can add visual clutter, especially if you have a large number of plugins installed.

Methods to Remove Plugin Action Links

There are several ways to remove these action links from your WordPress plugin list. Here's a breakdown of the most common methods:

1. Using a Plugin

One of the easiest ways to remove plugin action links is to use a dedicated plugin. A popular option is "Remove Plugin Action Links" by WebToffee. This plugin offers a simple interface, allowing you to control which links are displayed and which are hidden.

How it Works:

  1. Install and activate the "Remove Plugin Action Links" plugin.
  2. Navigate to the plugin's settings page.
  3. Select the specific actions you want to hide, such as "Edit," "Deactivate," or "Delete."
  4. Save your changes.

2. Adding Custom CSS

For a more hands-on approach, you can use custom CSS to hide the plugin action links. This method requires a basic understanding of CSS, but it offers more flexibility and control.

Here's a CSS snippet to hide all action links:

.plugin-action-buttons {
    display: none;
}

To apply this CSS:

  1. Go to "Appearance" > "Customize" > "Additional CSS."
  2. Paste the CSS code into the editor.
  3. Click "Save & Publish."

Note: This approach will hide all plugin action links, including those for editing, deactivating, and deleting plugins. If you only want to hide specific links, you'll need to modify the CSS selector accordingly.

3. Using a Code Snippet

For a more targeted approach, you can use a code snippet to hide specific action links. This method requires a bit more technical knowledge but offers more control over which actions are displayed.

Here's an example code snippet to hide the "Delete" action:

add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'remove_plugin_delete_link', 10, 2 );

function remove_plugin_delete_link( $actions, $plugin_file ) {
    unset( $actions['delete'] );
    return $actions;
}

To add this code:

  1. Go to "Plugins" > "Editor."
  2. Select the "functions.php" file for your theme.
  3. Paste the code snippet at the bottom of the file.
  4. Click "Update File."

Note: Remember to replace plugin_basename( __FILE__ ) with the actual basename of your plugin file. This snippet will hide the delete link for the current plugin.

4. Modifying the Plugin File

For maximum control, you can directly edit the plugin file itself. This method is generally not recommended as it can break the plugin functionality if you make mistakes.

Here's how to modify the plugin file:

  1. Locate the plugin's main file (usually the "plugin.php" file).
  2. Open the file in a text editor.
  3. Find the code that generates the action links (usually within a function named something like plugin_action_links).
  4. Remove or comment out the specific code lines responsible for generating the action links you want to hide.
  5. Save the changes to the file.

Important: Always create a backup of the plugin file before making any changes.

Things to Consider

  • Plugin compatibility: Ensure that the chosen method is compatible with the specific plugins you want to modify.
  • Security: While removing action links can enhance visual appeal, it's important to consider the potential security implications. Ensure you still have alternative ways to manage your plugins if necessary.
  • User experience: Carefully evaluate the impact on your user experience before making any changes.
  • Regular updates: Be aware that future updates to plugins or WordPress might restore the action links, requiring you to reapply the chosen method.

Conclusion

Removing plugin action links from your WordPress plugin list can improve the visual appearance of your admin area and streamline your plugin management experience. Choose the method that best suits your needs and comfort level. Remember to prioritize security and user experience throughout the process.