admin管理员组文章数量:1430840
Is there a way to remove & redirect any users of a site from accessing
/
Unless there id is one, i have seen some examples floating around the ask if admin-ajax is being used if so redirect. how ever this is not approach i wish to make as im using admin ajax on the front end for some admins. i just don't wish them to see anything to do with the backend of wordpress.
Only userid 1 should have access to wp-admin.
Is there a way to remove & redirect any users of a site from accessing
https://www.example/wp-admin/
Unless there id is one, i have seen some examples floating around the ask if admin-ajax is being used if so redirect. how ever this is not approach i wish to make as im using admin ajax on the front end for some admins. i just don't wish them to see anything to do with the backend of wordpress.
Only userid 1 should have access to wp-admin.
Share Improve this question edited Apr 30, 2019 at 18:06 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Apr 30, 2019 at 13:59 MicMic 101 3- What is the purpose of restricting users on this site? Can you just make all the users without access be Subscribers? – Welcher Commented Apr 30, 2019 at 15:27
- Restrict wp-admin by user role is an easier option. – Luke Cavanagh Commented Apr 30, 2019 at 15:46
- you can use this plugin wordpress/plugins/wps-hide-login/ – Miss Tahereh HZ Commented Apr 30, 2019 at 16:05
3 Answers
Reset to default 0There is a useful plugin dedicated for this task called : Remove Dashboard Access which allows you to remove direct access to wp-admin for all users except the admins.
As well you can try using WPS Hide Login plugin( https://wordpress/plugins/wps-hide-login/)
You could try something like:
if ( is_admin() && 1 !== absint( get_current_user_id() ) && ! wp_doing_ajax() ) {
wp_safe_redirect( '/' );
exit;
}
本文标签: Hide Wordpress “wpadmin” dashboard to User IDS
版权声明:本文标题:Hide Wordpress “wp-admin” dashboard to User IDS 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745534382a2662205.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论