WordPress后台登录后跳转到前台的指定页面

常用教程评论3,001阅读模式

登录后跳转到指定页面。文章源自原紫番博客-https://www.yuanzifan.com/54598.html

首先,创建页面,并修改页面的URL,比如将页面命名为Firstpage。文章源自原紫番博客-https://www.yuanzifan.com/54598.html

这里要说清楚:比如你的站点是www.abc.com。那么你设置了一个www.abc.com/firstpage的页面文章源自原紫番博客-https://www.yuanzifan.com/54598.html

然后写入下面的代码(代码写在function.php里面),reture home_url里面的页面名写firstpage。保存后,在wp-admin后台登录,即可跳转到你指定的firstPage页面。文章源自原紫番博客-https://www.yuanzifan.com/54598.html

function login_redirect( $redirect_to, $request, $user ){   
    return home_url('firstpage');   
}   
add_filter( 'login_redirect', 'login_redirect', 10, 3 );

 文章源自原紫番博客-https://www.yuanzifan.com/54598.html 文章源自原紫番博客-https://www.yuanzifan.com/54598.html

 

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证