How to Disable Primary Header in Astra?
|
/ Documentation /Custom Code Snippets/Astra Header & Footer Filters/ How to Disable Primary Header?

How to Disable Primary Header?

You can disable Astra Primary Header from the entire site by adding a filter code to the child theme’s functions.php file. 

If you’re using the Old (Legacy) Astra Header for your website, you can add the following code:

add_action( 'wp', 'astra_remove_header' );

function astra_remove_header() {
    remove_action( 'astra_masthead', 'astra_masthead_primary_template' );
}

On the other side, if you’re using the new Header Footer Builder (or decided to switch to it from the Legacy Header), you will need to use a different code instead:

add_action( 'wp' , 'astra_remove_new_header' );

function astra_remove_new_header() {
remove_action( 'astra_primary_header', array( Astra_Builder_Header::get_instance(), 'primary_header' ) );
remove_action( 'astra_mobile_primary_header', array( Astra_Builder_Header::get_instance(), 'mobile_primary_header' ) );
}
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

This field is required.

REWIND

YEAR IN REVIEW

Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form