Last active
October 4, 2015 14:28
-
-
Save erickarbe/2653414 to your computer and use it in GitHub Desktop.
WordPress Snippets for functions.php
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
/** | |
* | |
* HIDE THE WORDPRESS UPDATE NOTIFICATION (FOR ALL USERS EXCEPT SYSADMIN) | |
* | |
**/ | |
global $user_login; | |
get_currentuserinfo(); | |
if (!current_user_can('update_plugins')) { // checks to see if current user can update plugins | |
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 ); | |
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) ); | |
} | |
/** | |
* | |
* HIDE THE PLUGIN NOTIFICATIONS | |
* | |
**/ | |
function hide_plugin_update_indicator(){ | |
global $menu,$submenu; | |
$menu[65][0] = 'Plugins'; | |
$submenu['index.php'][10][0] = 'Updates'; | |
} | |
add_action('admin_menu', 'hide_plugin_update_indicator'); | |
/** | |
* | |
* REMOVE LOGIN ERRORS FROM WP LOGIN PAGE | |
* | |
**/ | |
add_filter('login_errors', 'explain_less_login_issues'); | |
function explain_less_login_issues() { | |
return '<strong>ERROR</strong>: Entered credentials are incorrect.'; | |
} | |
/* | |
* | |
* HIDE MENU ITEMS THAT WE DON'T USE | |
* | |
*/ | |
function remove_menus () { | |
global $menu; | |
$restricted = array(__('Links'), __('Tools'), __('Plugins')); | |
end ($menu); | |
while (prev($menu)){ | |
$value = explode(' ',$menu[key($menu)][0]); | |
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);} | |
} | |
} | |
add_action('admin_menu', 'remove_menus'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment