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

查看:77
本文介绍了在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天全站免登陆