How to Disable All Meta Settings of Page/Post with Astra?
|
/ Documentation /Custom Code Snippets/Astra Theme & Pro Filters/ Disable All Meta Settings of Page/Post by Default

Disable All Meta Settings of Page/Post by Default

Astra meta settings are page-specific settings. These settings allow you to disable Astra sections on a particular page/post.

Disable all Astra Meta Settings

In addition, you can disable all Astra meta settings on pages and posts by default (all boxes checked) by using a custom code.

Hence, to do this, add the following filter to the child theme’s functions.php file.

add_filter( 'astra_meta_box_options', 'default_disable_options' );

/**
* Default disable the Meta Options
*
* @param array $meta_option Page Meta.
* @return array
*/
function default_disable_options( $meta_option ) {

    $meta_option['ast-hfb-above-header-display'] = array(
            'default'  => 'disabled',
            'sanitize' => 'FILTER_DEFAULT',
    );
    $meta_option['ast-main-header-display'] = array(
            'default'  => 'disabled',
            'sanitize' => 'FILTER_DEFAULT',
    );
    $meta_option['ast-hfb-below-header-display'] = array(
            'default'  => 'disabled',
            'sanitize' => 'FILTER_DEFAULT',
    );
    $meta_option['ast-hfb-mobile-header-display'] = array(
            'default'  => 'disabled',
            'sanitize' => 'FILTER_DEFAULT',
    );
    $meta_option['footer-sml-layout'] = array(
            'default'  => 'disabled',
            'sanitize' => 'FILTER_DEFAULT',
    );
    $meta_option['footer-adv-display'] = array(
            'default'  => 'disabled',
            'sanitize' => 'FILTER_DEFAULT',
    );
    $meta_option['site-post-title'] = array(
            'default'  => 'disabled',
            'sanitize' => 'FILTER_DEFAULT',
    );
    $meta_option['site-sidebar-layout'] = array(
            'default'  => 'disabled',
            'sanitize' => 'FILTER_DEFAULT',
    );
    $meta_option['site-content-layout'] = array(
            'default'  => 'disabled',
            'sanitize' => 'FILTER_DEFAULT',
    );
    $meta_option['ast-featured-img'] = array(
            'default'  => 'disabled',
            'sanitize' => 'FILTER_DEFAULT',
    );
    $meta_option['ast-breadcrumbs-content'] = array(
            'default'  => 'disabled',
            'sanitize' => 'FILTER_DEFAULT',
    );

    return $meta_option;
}
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