Support

Account

Home Forums ACF PRO Hide an ACF group/meta box

Unread

Hide an ACF group/meta box

  • I am struggling to hide an ACF field group/meta box from outputting.

    When some conditionals are met, the whole box shouldn’t be outputted because there are no fields in there (because conditional logic by php)

    This is my code:

    if ( is_admin() && isset( $_GET[ 'post' ] ) && 'my-post-type' == get_post_type( $_GET[ 'post' ] ) ) {
        $blocks  = get_field_objects( $_GET[ 'post' ] );
        if ( isset( $blocks['blocks']['value'][0] ) && 'block_slider' == $blocks['blocks']['value'][ 0 ][ 'acf_fc_layout' ] ) {
            remove_meta_box( 'acf-group_5b280349c2cd5', 'my-post-type', 'normal' );
        }
    }

    Any one have any luck with it ? The code above only moves it to the top of the page/groups.

Viewing 1 post (of 1 total)

The topic ‘Hide an ACF group/meta box’ is closed to new replies.