Archived topic
filter in functions.php child theme not working
5 replies · Started by Wilfred on June 27, 2017
Really strange thing. When I add this piece of code in the functions.php of my child theme:
add_filter( 'generate_show_title', 'your_function_name' );
function your_function_name()
{
return false;
}
it's not working. When I add this to my functions.php of generatepress (not the child theme of generatepress) it works. Is this normal? And yes :) I'm using the Child theme.
You may need to hook it into an action like after_setup_theme which makes sure the filter has initiated.
add_action( 'after_setup_theme', 'tu_remove_title' );
function tu_remove_title() {
add_filter( 'generate_show_title', '__return_false' );
}
Yes, that worked. And I understand what you did... thanks!
You're welcome :)
The amount of snippets that I've added and never worked... now I know why. :)
Thanks, Tom.
Sometimes it can be a pain! Glad I could help :)