Created
April 5, 2020 14:52
-
-
Save joychetry/acab54c11ad6bf2bca943aab3e5088fb to your computer and use it in GitHub Desktop.
Remove Update and Deactivate Plugin Options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Removing plugin controls from admin | |
function remove_plugin_controls($actions, $plugin_file, $plugin_data, $context){ | |
if (array_key_exists('edit', $actions)) { | |
unset($actions['edit']); | |
} | |
if (array_key_exists('deactivate', $actions)) { | |
unset($actions['deactivate']); | |
} | |
if (array_key_exists('activate', $actions)) { | |
unset($actions['activate']); | |
} | |
if (array_key_exists('delete', $actions)) { | |
unset($actions['delete']); | |
} | |
return $actions; | |
} | |
add_filter('plugin_action_links', 'remove_plugin_controls', 10, 4); | |
// Remove bulk action options for managing plugins | |
function disable_bulk_actions($actions){ | |
if (array_key_exists('deactivate-selected', $actions)) { | |
unset($actions['deactivate-selected']); | |
} | |
if (array_key_exists('activate-selected', $actions)) { | |
unset($actions['activate-selected']); | |
} | |
if (array_key_exists('delete-selected', $actions)) { | |
unset($actions['delete-selected']); | |
} | |
if (array_key_exists('update-selected', $actions)) { | |
unset($actions['update-selected']); | |
} | |
} | |
add_filter('bulk_actions-plugins','disable_bulk_actions'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment