Home Forums Feedback ACF Postbox classes / CSS identifiers Reply To: ACF Postbox classes / CSS identifiers

  • Thanks for this guys was very helpful. If you don’t want to replace the existing style just use .= to append your style, simply remember to have it be a space before your class.

    And if you need to only affect a specific metabox you can use the $content[‘ID’] to compare.

    Here’s what I’ve done to add Woo’s hide_if_external class to remove my metabox for external products;

    function change_style_test($content) {
        if ( ! empty( $content ) && array_key_exists( 'ID', $content ) && ! empty( $content['ID'] ) && $content['ID'] == 4970) {
            $content['style'] .= ' hide_if_external';
        return $content;
    add_filter('acf/get_field_group', 'change_style_test');

    All the best,