$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>theme development - Is <title> tag default in WordPress?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

theme development - Is <title> tag default in WordPress?

matteradmin9PV0评论

This may be a stupid questions but I have been building some themes. Some of them doesn't include the <title> in the head and some of the theme include it.

I belive some SEO plugin can add <meta> tag in the head but what about title?

So, is it because the SEO plugin or it is default by WordPress included in wp_head()?

This may be a stupid questions but I have been building some themes. Some of them doesn't include the <title> in the head and some of the theme include it.

I belive some SEO plugin can add <meta> tag in the head but what about title?

So, is it because the SEO plugin or it is default by WordPress included in wp_head()?

Share Improve this question edited Jan 31, 2019 at 9:04 Krzysiek Dróżdż 25.6k9 gold badges53 silver badges74 bronze badges asked Jan 31, 2019 at 8:51 Aftar FadilahAftar Fadilah 253 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 3

Well, it's not a stupid question at all...

wp_title is a template tag and it was used for a long time (since 1.0.0) to put <title> tag in the header. This way plugins were able to modify the title with filters. In WP 4.4 it was about to be deprecated, but that idea was abandoned and you can still use that function.

On the other hand, you don't have to. Since WP 4.1 you can use title-tag theme feature instead.

So if your theme declares that it supports title-tag feature, then the title tag will be generated automatically and you don't have to put it manually in the header any more. And to declare that you're supporting such feature you need something like this in your code:

function theme_slug_setup() {
   add_theme_support( 'title-tag' );
}
add_action( 'after_setup_theme', 'theme_slug_setup' );
Post a comment

comment list (0)

  1. No comments so far