Limit plugin access


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. add_filter( 'plugin_action_links', 'slt_lock_plugins', 10, 4 );
  2. function slt_lock_plugins( $actions, $plugin_file, $plugin_data, $context ) {
  3. // Remove edit link for all
  4. if ( array_key_exists( 'edit', $actions ) )
  5. unset( $actions['edit'] );
  6. // Remove deactivate link for crucial plugins
  7. if ( array_key_exists( 'deactivate', $actions ) && in_array( $plugin_file, array(
  8. 'slt-custom-fields/slt-custom-fields.php',
  9. 'slt-file-select/slt-file-select.php',
  10. 'slt-simple-events/slt-simple-events.php',
  11. 'slt-widgets/slt-widgets.php'
  12. )))
  13. unset( $actions['deactivate'] );
  14. return $actions;
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.