Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Friendlier, Safer WordPress Admin Areas

2,655 views

Published on

The WordPress Administration area is no walk in the park. Just because it’s, perhaps, the most user-friendly of the big CMSs doesn’t necessary make it objectively easy to use. All sorts of things that can seriously break your site are mixed in with trivial options. And, once you start adding robust plugins, things can get complicated fast.

There are many ways to make WordPress more palatable for the common user (see: non-developers) and reduce the risk of big-time accidents. In this session, I’ll show you how easy it is to remove things users don’t need from the admin area—all with your own plugin.

Don’t worry if you haven’t written a plugin before. Not only will I give you the working plugin to start with, but I’ll explain everything along the way.

Let’s make WordPress just a little easier and safer for everyone!

Published in: Technology

Friendlier, Safer WordPress Admin Areas

  1. 1. A Friendlier, Safer Admin
  2. 2. @cliffseal
  3. 3. cliffseal.com/ friendlyadmin
  4. 4. SRSLY, THE ADMIN? “I am super good at it.”
  5. 5. YOU, MAYBE
  6. 6. MANY USERS
  7. 7. SAFE ZONE
  8. 8. DRAGONS
  9. 9. OH HEY, HERE’S STUFF ¯_(ツ)_/¯
  10. 10. &FRIENDLIER SAFER LET’S MAKE IT FOR EVERYONE
  11. 11. CLEAN HOUSE Step 1
  12. 12. DO NOT NEED function yourplugin_remove_tools() { remove_submenu_page( 'tools.php', 'tools.php' ); } add_action( 'admin_menu', 'yourplugin_remove_tools', 999 );
  13. 13. MENU FUBAR function yourplugin_remove_admin_bar_links() { global $wp_admin_bar; $wp_admin_bar->remove_menu('w3tc-faq'); $wp_admin_bar->remove_menu('w3tc-support'); } add_action( 'wp_before_admin_bar_render', 'yourplugin_remove_admin_bar_links' );
  14. 14. DASHBORED function yourplugin_disable_dashboard_widgets() { remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' ); } add_action( 'admin_init', 'yourplugin_disable_dashboard_widgets' );
  15. 15. KNOW YOUR ROLE Step 2
  16. 16. GET WIDGET function yourplugin_add_theme_caps() { $role_object = get_role( 'editor' ); $role_object->add_cap( 'edit_theme_options' ); } add_action( 'admin_init', ‘yourplugin_add_theme_caps' );
  17. 17. LESS NAGS Step 3
  18. 18. AD BLOCKER function yourplugin_remove_customizer_nags() { global $wp_customize; $wp_customize->remove_section( get_template() . '_theme_info'); } add_action( 'customize_register', ‘yourplugin_remove_customizer_nags', 20 );
  19. 19. NEED-TO-KNOW function yourplugin_remove_gotdang_nags() { remove_action( 'admin_notices', 'woothemes_updater_notice' ); } add_action( 'init', 'yourplugin_remove_gotdang_nags');
  20. 20. UNPLUG Step 4
  21. 21. HIDE YOSELF function return_false() { return false; } add_filter( ‘show_advanced_plugins', 'return_false' );
  22. 22. HIDE OTHERS function yourplugin_hide_plugin_details( $links, $file ) { $links = array(); return $links; } add_filter( ‘plugin_row_meta', 'yourplugin_hide_plugin_details', 10, 2 );
  23. 23. NO THANKS function yourplugin_hide_plugin_links( $links ) { if ( !empty($links['deactivate']) ) { $links = array( 'deactivate' => $links['deactivate'] ); } return $links; } add_filter( ‘plugin_action_links_wordpress-seo/wp-seo.php', ‘yourplugin_hide_plugin_links' );
  24. 24. function yourplugin_filter_plugins( $plugins ) { $hidden = array( 'Sucuri Security - Auditing, Malware Scanner and Hardening', 'W3 Total Cache', 'Amazon S3 and CloudFront' ); if ( !isset($_GET['seeplugins']) || $_GET['seeplugins'] !== 'fisho' ) { foreach ($plugins as $key => &$plugin ) { if ( in_array( $plugin["Name"], $hidden ) ) { unset($plugins[$key]); } } } return $plugins; } add_filter( ‘all_plugins', ‘yourplugin_filter_plugins' );
  25. 25. function yourplugin_remove_tools() { remove_submenu_page( 'tools.php', 'tools.php' ); remove_menu_page( 'sucuriscan' ); remove_menu_page( 'w3tc_dashboard' ); remove_menu_page( 'amazon-web-services' ); remove_submenu_page( 'options-general.php', 'wpmandrill' ); remove_submenu_page( 'plugins.php', 'cloudflare' ); } add_action( 'admin_menu', 'yourplugin_remove_tools', 999 ); NO TOUCHY
  26. 26. DEFINE( 'DISALLOW_FILE_EDIT', TRUE );
  27. 27. /* You better only be doing this if you’re 100% in charge of updating things for clients and don’t want them adding anything. */ define( 'DISALLOW_FILE_MODS', true ); DIY (NO, YOU)
  28. 28. EMPOWER USERS TO LOVE WORDPRESS
  29. 29. QUESTIONS?
  30. 30. Thank you

×