-
-
Save eartisan-uk/f1985ec41e69e73714d561f4af55756c to your computer and use it in GitHub Desktop.
Cleanup WordPress plugin admin
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