I am currently designing a custom WordPress theme from scratch and designing the header.php part now. I was coding for the title tags and when I was done and tested, everything was alright excepting title for pages.

I wanted the title for pages to be as follows;

Homepage: (Blog Name) - Let's Make Things Happen
All other pages: Page title
Posts: Post title
Search page: You search for (search query)
404 Not found: Page not found

As I mentioned above, everything went right but not page titles as it is still showing Page title - Page name whereas I did not use any PHP command for this and to be honest, I tried but could not correct it. Please help me modifying the code I used in my header.php file. I am sending you the screenshot of that code pointing that PHP command I thought was wrong.

Code I used in that header.php file

Please help me out experts.

  • Have you tried deactivating all plugins? Some plugins filter wp_title() so it sounds like something outside your own code may be making changes before the final <title> is output. – WebElaine Aug 17 at 14:17
  • Yes, I have no plugin activated. I am making a custom theme and did not use any plugin yet. I think, I will have to change PHP command for the bordered one in the image a bit. – Rishabh Aug 19 at 4:00
  • You could use the_title(); to just use the Post Title without WP adding anything on. – WebElaine Aug 20 at 15:18

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.