将此代码添加到函数中。php
if ( !function_exists( \'yourtheme_setup\' ) ) {
function yourtheme_setup() {
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( \'title-tag\' );
}
add_action( \'after_setup_theme\', \'yourtheme_setup\' );
}
或者,如果您的功能。php已经有
after_setup_theme
, 只需添加行
add_theme_support( \'title-tag\' );
进入您的
after_setup_theme
. (
Source)