Archived topic
Change displayed page title (without changing menu titles)
3 replies · Started by Randy on January 6, 2021
Hi,
I thought this would be easy, but maybe I'm overlooking something? When I try to use add_filter('the_title') to change a static page title on the fly with php, it also changes menu titles.
This person came up with the answer here: https://wordpress.stackexchange.com/questions/309151/apply-the-title-filter-in-post-page-title-but-not-in-menu-title#answers
But wanted to check if all of that is necessary or if there's another generate hook I could use (I saw generate_get_the_title_parameters but couldn't determine that would work)
Thank you!
Hi there,
see Toms answer here:
https://generatepress.com/forums/topic/change-page-title-programmatically/#post-1377184
The alternative being something like the code you found on Stackoverflow
Cool! Thought I'd check. Was able to make it work with the stackoverflow approach, as convoluted as it seems ;)
Yes the_title() element is a pain - as it is used in may places throughout WP and Plugins.
Glad to hear you got it working.