[WordPress] How to remove the space at the beginning of wp_title

[WordPress] How to not create author/poster archives

In the previous article, I wrote that only the page title is displayed when posting a single article (single.php).

[Related]: [WordPress] How to display the page title and how it should be displayed

That's why I wrote it as follows.

<title><?php wp_title(''); ?></title>

However, when I looked at the source code of each article, there was a space before the [page title].

There is a space before [page title]

It may not be a big problem, but it's kind of disgusting, so I tried to fix it a little.

So, I rewritten it as follows.

<title><?php echo trim(wp_title('', false)); ?></title>

I was able to remove the spaces at the beginning of wp_title using the trim function.

Congratulations!

  • Add this entry to Hatena Bookmarks

At "naouniverse.com", the administrator writes about things, things, and the world that interest him.
Gadgets, cameras, design, programming, L'Arc~en~Ciel, etc...