Support

Account

Home Forums Backend Issues (wp-admin) Conditionally format a tab name if internal field has value Reply To: Conditionally format a tab name if internal field has value

  • Now I see, WP is setting the font weight for b,strong to 600. ACF is also setting the font weight of tab text to 600, so there’s no difference. You will need to set the font weight. You can do this in one of two ways. You can add a custom style sheet for the admin or you can do it inline. I would do it inline.

    
    // add filter using field key, change to your tab field's key
    add_filter('acf/prepare_field/key=field_123456', 'custom_tab_format', 20);
    function custom_tab_format($field) {
      // see if other field has value
      if (get_field('other_field_name')) {
        $field['label'] = '<strong style="font-weight: bold;">'.$field['label'].'</strong>';
      }
      return $field;
    }