Skip to content

Instantly share code, notes, and snippets.

@crewstyle
Created April 20, 2016 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crewstyle/71e6715076abe27bad166fcccb9863e1 to your computer and use it in GitHub Desktop.
Save crewstyle/71e6715076abe27bad166fcccb9863e1 to your computer and use it in GitHub Desktop.
WordPress ~ WP version check for admin role only - #backend #security
<?php
/**
* Sets up WP version check for admin role only.
*
* @uses current_user_can() To know if current user has permissions.
* @uses add_action() To add a hook action.
* @uses add_filter() To add a hook filter.
* @see https://github.com/crewstyle/clean-wordpress
*/
add_action('after_setup_theme', '_cw_remove_admin_wp_version_check');
function _cw_remove_admin_wp_version_check()
{
//Remove WORDPRESS update in the administration to all users, except the admin
if (!current_user_can('edit_users')) {
add_action('init', create_function('$a', "remove_action('init', 'wp_version_check');"), 2);
add_filter('pre_option_update_core', create_function('$a', "return null;"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment