Support

Account

Forum Replies Created

  • If you want to manage more than one tab, I used a unique function name for each instance:

    add_filter('acf/prepare_field/key=field_key', 'custom_tab_format', 20);
    function custom_tab_format($field) { 
    if(get_field('this_field', $post->ID)) { 
      $field['label'] = get_field('this_field', $post->ID); 
    } 
    return $field; }
    add_filter('acf/prepare_field/key=field_key', 'custom_tab_format_two', 20);
    function custom_tab_format_two($field) { 
    if(get_field('this_field', $post->ID)) { 
      $field['label'] = get_field('this_field', $post->ID); 
    } 
    return $field; }

    Hopefully this is helpful to others.

  • Ah, nevermind, found another post and between the two, here’s the solution to target the key:

    add_filter('acf/prepare_field/key=field_key', 'custom_tab_format', 20);
    function custom_tab_format($field) { 
    if(get_field('this_field', $post->ID)) { 
      $field['label'] = get_field('this_field', $post->ID); 
    } 
    return $field; }
    
  • Okay, found the problem. It existed between the keyboard and chair. *head desk*

    Thanks for your patience, John!

  • What’s odd is that it will work for a field with just a general numerical value. It’s just the date that’s the breakdown.

    The only “pre_get_posts” filter I have is in regards to stopping empty search returns. I disabled it and the issue continues.

    I’ll keep looking but this … it doesn’t make sense.

  • That’s why I’m confused. Been working with ACF for a while and custom fields in general, but this one has me stumped.

    The dates & corresponding post_ids are as follows so even if it wasn’t reading the custom field and default ordering by post ID, I’d still expect it to be in order, and the post names follow a similar hierarchy. It should be falling in the correct order regardless of the field, title, or post id.

    20160724 – post_id: 2392 – “product 2”
    20160104 – post_id: 2390 – “product 1”
    20190414 – post_id: 2394 – “product 3”

    I’m well and truly stumped. Anyone have this issue and care to share their solution or things to check?

  • No luck.

    I confirmed that the date is being stored in the YYYYMMDD format within the database.

Viewing 6 posts - 1 through 6 (of 6 total)