Deny except from specific IPs Order deny,allow Deny from All Allow from xxx.xxx.xxx.xxx Allow from xxx.xxx.xxx.xxy Allow except from specific IPs Order deny,allow Allow from All Deny from xxx.xxx.xxx.xxx Deny from xxx.xxx.xxx.xxy Reference URL
Articles Tagged: Restrictions
Remove WordPress Admin Bar Menu Items
function dashboard_tweaks() { global $wp_admin_bar; $wp_admin_bar->remove_menu(‘wp-logo’); $wp_admin_bar->remove_menu(‘about’); $wp_admin_bar->remove_menu(‘wporg’); $wp_admin_bar->remove_menu(‘documentation’); $wp_admin_bar->remove_menu(‘support-forums’); $wp_admin_bar->remove_menu(‘feedback’); $wp_admin_bar->remove_menu(‘view-site’); } add_action( ‘wp_before_admin_bar_render’, ‘dashboard_tweaks’ ); Reference: http://pastebin.com/Wrk0JPxw
Remove Admin Backend Menus for all users, except User #1 (usually the first Admin)
/*———————————————————————————–*/ /* Restrict access /*———————————————————————————–*/ function remove_menus () { global $menu; $user = wp_get_current_user(); if ($user->ID!=1) { // Is not administrator, $restricted = array(__(‘Dashboard’), __(‘Posts’), __(‘Media’), __(‘Links’), __(‘Pages’), __(‘Appearance’), __(‘Tools’), __(‘Users’), __(‘Settings’), __(‘Comments’), __(‘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’);
Remove Admin (User #1) from User list
function your_pre_user_query($user_search) { $user = wp_get_current_user(); if ($user->ID!=1) { global $wpdb; $user_search->query_where = str_replace(‘WHERE 1=1’, “WHERE 1=1 AND {$wpdb->users}.ID<>1”,$user_search->query_where); } } add_action(‘pre_user_query’,’your_pre_user_query’);
Display Specific Content only for logged in users
Tested on: WordPress 3.0.1 function content_only4logged_in($content) { // ALL LOGGED IN USERS if ( is_user_logged_in() && !is_null($content) && !is_feed() ) { return $content; } else { $content = wp_html_excerpt( $content, 80 ); $content .= ‘ …’; $content .= __( ‘Sorry, more of this content is only available for logged users.’, FB_TEXTDOMAIN ); return $content; } […]
Only show posts and media of the logged-in Author & fix the post/media counts on the filter bars.
Tested on: WordPress 3.4.1 By default, WordPress allows Authors to see the titles of other users posts, unpublished drafts, and all media, even though they cannot be edited. Use this code to only allow posts and media of the currently logged in Author to be displayed. Unlike other solutions, this also fixes the post/media count […]