Hide The WordPress Dashboard and wp-admin COMPLETELY!
Last Updated on Thursday, 9 September 2010 09:27
Written by Erock
Wednesday, 8 September 2010 04:04
Written by Erock
Wednesday, 8 September 2010 04:04
WordPress 3 Compatible
I have seen several plugins that “hide” the dashboard from subscribers, but none that functions as I want.
I don’t want it to allow only the tools, and profile page. I want it to straight kick the user out of the dashboard!
So, I wrote my own plugin that does that. If anyone that is not an admin (cannot activate plugins) attempts to access the dashboard via url or link, they are redirected to the front of the site. sorry, access denied..
Here is my code. Just drop this in your themes functions.php file and edit the url of the redirect to whatever you want.
{code type=php}
//hook onto dashboard and redirect all non admin to front site
add_action(“admin_init”,”redirect_nonadmin_fromdash”);
function redirect_nonadmin_fromdash(){
if (!current_user_can(‘activate_plugins’)) {
// Edit Line Below For Your Own Redirect
header( ‘Location: http://www.erikshosting.com’ ) ;
}
}
{/code}
//hook onto dashboard and redirect all non admin to front site
add_action(“admin_init”,”redirect_nonadmin_fromdash”);
function redirect_nonadmin_fromdash(){
if (!current_user_can(‘activate_plugins’)) {
// Edit Line Below For Your Own Redirect
header( ‘Location: http://www.erikshosting.com’ ) ;
}
}
{/code}
Tags: buddypress, dashboard redirects, hide dashboard, hide wp-admin, php code help, redirect users, remove dashboard, remove entire dashboard, web design, wordpress tips, wp support, wp-admin redirect, wp3
This entry was posted on Wednesday, September 8th, 2010 at 4:04 am and is filed under Wordpress Tips.
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
10 Comments
Leave a Reply to Vladimir
Categories
Archives
- Pro -Sites Shortcodes, Functions, And Level Checks
- Automatic WP Photo Gallery From Facebook Page Photos!
- Analytics 360 For Editors
- Add nofollow rel tags to image widget
- Image Widget Alignment Fix
- Add GD Star Rating next to Post Title
- Change The Buddypress Admin Bar Logo And Link In WP3 & BP 1.2+!
- New Dashboard Lockdown & WordPress To Buddypress Profile Page Plugin!
- Hide The WordPress Dashboard and wp-admin COMPLETELY!
- Blogs & Members Directory, Strange Nav Spacing FIX
Tags
art wear
ashland
ashland oregon
buddypress
chrome
clear dashboard
code
dashboard widgets
download
drop down menu
hawaii
iframe
image widget
kauai
kauai hawaii
kauai web
limit login attempts
multi-site
new blog defaults
oregon
paintball
plugin commander
plugin management
plugin management update
remove dashboard widgets
remove recent drafts
remove right now
safari
search engine optimization
shortcode
southern Oregon
web design
web development
web hosting
webkit
wordpress
wordpress mu
wordpress security
wp3
wp3 compatible
wpms
wpmu
wpmu2.9
wpmu compatible
wpmu security
Tags
art wear
ashland
ashland oregon
buddypress
chrome
clear dashboard
code
dashboard widgets
download
drop down menu
hawaii
iframe
image widget
kauai
kauai hawaii
kauai web
limit login attempts
multi-site
new blog defaults
oregon
paintball
plugin commander
plugin management
plugin management update
remove dashboard widgets
remove recent drafts
remove right now
safari
search engine optimization
shortcode
southern Oregon
web design
web development
web hosting
webkit
wordpress
wordpress mu
wordpress security
wp3
wp3 compatible
wpms
wpmu
wpmu2.9
wpmu compatible
wpmu security
Excellent decision! Been looking for and then you helped me. Realized directly on the site. Immediately save 4 MB memory on the server!
Great Stuff!
is there away to allow dashboard access to the editor role as well?
Yah,
simply swap the part that says
if (!current_user_can('activate_plugins'))
with this:
if (!current_user_can('publish_posts'))
Thats it!
I don’t want my users kicked out of the dashboard. I just want some widgets to be removed off of it. Is that possible??
PERFECT! Changed a couple little things but this is perfect! Thanks.
Wonderful
Hi,
Can we hide through .htaccess file I have read that but when I do that its not working if you have any idea for that
Thanks
How to redirect them when login to the latest visited page, such as get_permalink()?
I want specific about this
Great trick
nice work!!