admin管理员组文章数量:1328015
I would like to change the /wp-admin/index.php
default page to something like /wp-admin/edit.php?post_type=page
so that when a user logs in, they get redirected to /wp-admin/edit.php?post_type=page
instead of /wp-admin/index.php
. I will appreciate guides on this
I would like to change the /wp-admin/index.php
default page to something like /wp-admin/edit.php?post_type=page
so that when a user logs in, they get redirected to /wp-admin/edit.php?post_type=page
instead of /wp-admin/index.php
. I will appreciate guides on this
1 Answer
Reset to default 1There's a filter called login_redirect
where you can change the URL users get redirected to after logging in.
There's a nice example in the comments of the documentation page here: https://developer.wordpress/reference/hooks/login_redirect/
Here's a suggestion of how you could modify it to do what you want:
function wpdocs_my_login_redirect( $url, $request, $user ) {
if ( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
if ( $user->has_cap( 'administrator' ) ) {
$url = home_url('/YOUR/CUSTOM/URL/HERE');
}
}
return $url;
}
add_filter( 'login_redirect', 'wpdocs_my_login_redirect', 10, 3 );
Note this code untested, let me know if you try it and have problems.
本文标签: Change wordpress admin home page
版权声明:本文标题:Change wordpress admin home page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742244530a2439045.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论