从5.2.0版开始不推荐使用LOGIN_Headertitle

时间:2019-10-26 作者:Sh.Dehnavi

朋友们,我有个问题。当我进入wordpress中的默认logn页面时,我看到了这个错误:
Notice: login_headertitle is deprecated since version 5.2.0! Use login_headertext instead. Usage of the title attribute on the login logo is not recommended for accessibility reasons. Use the link text instead. in /home/xxxxxxx/public_html/wp-includes/functions.php on line 4711
我正在使用wp veroin 5.2.1 我不使用任何插件来自定义登录页面。我在自己的文件中搜索了很多,但没有找到login_headertitle. 我只是在中使用以下代码functions.php 对于登录页面的自定义css:

function custom_login_css() {
    wp_enqueue_style( \'mylogincss\', get_template_directory_uri() . \'/css/custom-login-styles.css\' );
    }
add_action(\'login_head\', \'custom_login_css\');  

所以我很困惑,为什么我在登录页面的顶部看到这个错误<你能帮我修一下吗?

1 个回复
SO网友:Jeremy Tarpley

正如错误所述,WordPress不推荐使用login\\u headertitle函数。您很可能有一个插件或父主题正在使用此功能更改登录页面上的标题。检查插件和主题文件是否有任何更新。

看到此消息还表明您已在站点上启用调试。如果它是一个未在其上开发的实时站点,则可能需要禁用它。或者,您可以保持为开发启用调试,并将其记录到文件中,而不是显示在屏幕上。Wordpress.org has documentation on debugging.

如果您正在开发使用login\\u headertitle的主题或插件,那么很容易解决。如果对login\\u headertitle有add\\u操作或其他函数调用,只需将其替换为login\\u headertext即可。这是an example from the WordPress Code Reference for the login_headertext function:

// Customize login header text.
add_filter( \'login_headertext\', \'customize_login_headertext\' );

function customize_login_headertext( $headertext ) {
  $headertext = esc_html__( \'Add custom login page text here\', \'plugin-textdomain\' );
  return $headertext;
}

相关推荐

static array on functions.php

在函数中。php中,我想访问数据库一次,以获取一个ACF对象,然后在本地“保存”它,以防止对数据库的进一步请求。我想首先在“init”钩子中调用以下函数。然后,假设,当我在以后的挂钩上调用它时,由于使用了“static”关键字,$current\\u store var已经设置好了,函数将在第一个“if”返回已经保存的静态var时停止。它不起作用-当访问稍后挂钩上的函数时,“isset($current\\u store)”返回false。我做错了什么?function get_current_store