Support

Account

Home Forums General Issues How do you add [ get_comments_number() ] function in a custom field? Reply To: How do you add [ get_comments_number() ] function in a custom field?

  • You cannot add PHP to custom fields unless you create or add filters to run on them.

    http://www.advancedcustomfields.com/resources/acfformat_value/

    In ACF5 there are additional hooks other than the ones listed on that page, here is the code in ACF where they are called

    
    $value = apply_filters( "acf/format_value", $value, $post_id, $field );
    $value = apply_filters( "acf/format_value/type={$field['type']}", $value, $post_id, $field );
    $value = apply_filters( "acf/format_value/name={$field['name']}", $value, $post_id, $field );
    $value = apply_filters( "acf/format_value/key={$field['key']}", $value, $post_id, $field );