Support

Account

Home Forums General Issues acf/format_value date field limitations

Solving

acf/format_value date field limitations

  • Are there any limitation to the acf/format_value filter when using on a date field?

    For example if i do this:

    function my_acf_format_value( $value, $post_id, $field ) {
    if ($field["name"] == 'my_field_key') {
    
    $value = 'test';
    return $value;
    
    }
    }
    add_filter('acf/format_value', 'my_acf_format_value', 10, 3);

    on a text field it will echo ‘test’, but if i do it on a date field it will echo nothing. ?

  • Sorry – It will echo the original format date.

  • More than likely your filter is running before the ACF filter, but that’s just a guess. You can try setting the priority to 20 for your filter. The ACF filter attempts to correctly format the date. Passing it a non-date value will have unpredictable results.

  • Thanks, but the priority thing doesn’t work. btw – it’s the same thing with a number field type also.

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

The topic ‘acf/format_value date field limitations’ is closed to new replies.