Change Title Tag within page
-
I understand that the Title Tag is generated within wp_head when the page is generated. I have code in my 404 page for a special case that displays a page instead of the normal 404 page. As such I want the Title Tag to be updated to something other than ‘Page not found’ when this special case is detected.
Is it possible to change this on the fly within my 404.php page, and if so, how?
Right now all I can think to do is to have my checking for this special case within my header.php, which will end up putting this extra check into every single other page, which seems an unnecessary burden.
For what it’s worth, my special case is a page generated by my theme showing a list of all categories, an example link would be example.com/index.php/category, which normally would throw the 404 in WP.
- The topic ‘Change Title Tag within page’ is closed to new replies.