I am trying to remove the h1 title on my about page in my functions.php file.
Here is my code:
function remove_about_page_title()
{
if (is_page('about')) {
remove_action('storefront_page', 'storefront_page_header', 10);
}
}
add_action('init', 'remove_about_page_title');
If I do a var dump on is_page('about')
then I get false
even though it is the about page.
If I change my add_action()
function to run the remove_about_page_title()
function from init to storefront_page
then is_page()
prints true but the remove_action function no longer works.
Is this due to being out of the scope chain?
Is there a way to remove the page header inside the functions.php
file without CSS and #ids?
You have to use is_page('pageId')
instead of is_page('about')
;