登录 WordPress 后重定向 [英] Redirect after Login on WordPress

查看:40
本文介绍了登录 WordPress 后重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于现有网站创建自定义的 WordPress 主题.

I'm creating a customized WordPress theme based on an existing site.

我想使用我创建的备用仪表板.

I want to use an alternate dashboard which I have created.

如何让用户在登录后定向到news.php"而不是/wp-admin/"?

How can I have the user directed to 'news.php' after login instead of '/wp-admin/' ?

--

有一个可用的插件,但任何可以通过functions.php找到手动方法的人仍然可以获得赏金,因为它比使用第3方插件更安全-in.

推荐答案

这应该可以解决您的问题.改编自在此处找到的答案.

This should solve your problem. Adapted from an answer found here.

在您的主题的functions.php文件中添加以下代码片段:

Add the following snippet of code in the functions.php file of your theme:

function admin_default_page() {
  return '/new-dashboard-url';
}

add_filter('login_redirect', 'admin_default_page');

这篇关于登录 WordPress 后重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆