Archived topic
generate_show_title not working
4 replies · Started by Dan on March 30, 2017
It was my understanding the adding the following code to the Code Snippets would remove all Page Titles from the site, but it is not working. What else do I need to do to get this working?
Here is the code
add_filter( 'generate_show_title', 'remove_my_titles' );
function remove_my_titles()
{
return 'false';
}
Hi Dan,
The filter should still work and the code looks good.
Can you make sure Code Snippet is activated and make sure you click "Save Changes and Activate" in the actual snippet?
Let me know.
In some cases, a custom function can fire before the filter is ready.
When that happens, we can add the filter into a hook like after_setup_theme to make sure the function fires once the filter exists and is ready:
add_action( 'after_setup_theme','tu_remove_all_titles' );
function tu_remove_all_titles() {
add_filter( 'generate_show_title','__return_false' );
}
Thanks Tom - the hook worked.
You are a genious!!!
Glad I could help :)