简体   繁体   English

自定义 wp-login.php 登录标题

[英]Customize wp-login.php Login Title

Let me start off by saying that I am not very well-versed with PHP so any help is much appreciated.首先让我说我对 PHP 不是很精通,所以非常感谢任何帮助。

Here is my issue.这是我的问题。 I have a social media site built on WordPress.我有一个基于 WordPress 的社交媒体网站。 It is restricted to registered users only so when someone visits the site and is not logged in, they are automatically redirected to the wp-login.php page.它仅限于注册用户,因此当有人访问该站点但未登录时,他们会自动重定向到 wp-login.php 页面。

However, while trying to share the link of the site to people on other social media sites like Facebook, the sites pull the Open Graph data from the wp-login.php file which shows a site title like this:然而,当试图将网站链接分享给其他社交媒体网站(如 Facebook)上的人时,这些网站会从 wp-login.php 文件中提取 Open Graph 数据,该文件显示了如下所示的网站标题:

Log In > 5th Gear --- WordPress登录 > 5档 --- WordPress

I am wanting to remove the '--- WordPress' and have it so that the Open Graph data only shows as follows:我想删除“--- WordPress”并拥有它,以便 Open Graph 数据仅显示如下:

5th Gear Car Community五档汽车社区

I found the string in the wp-login.php file but do not want to modify core wp files.我在 wp-login.php 文件中找到了该字符串,但不想修改核心 wp 文件。

How can I achieve this?我怎样才能做到这一点?

You can use the login_title filter ( https://developer.wordpress.org/reference/hooks/login_title/ ).您可以使用 login_title 过滤器( https://developer.wordpress.org/reference/hooks/login_title/ )。 Change the title as needed.根据需要更改标题。 This can go in the functions.php file or a custom plugin.这可以在functions.php文件或自定义插件中的go。

for example:例如:

add_filter('login_title', custom_login_title, 99);
function custom_login_title($origtitle) { 

    return get_bloginfo('name');

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM