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?

  • this is explained on the page I linked to above http://www.advancedcustomfields.com/resources/acfformat_value/

    $value = the value which was loaded from the database
    $post_id = the post ID from which the value was loaded
    $field = An array containing all the field settings for the field which was used to upload the attachment

    Let’s say that you wanted to do sortcoded on all acf text fields

    
    add_flter('acf/format_value/type=text', 'text_field_do_shortcodes', 10, 3);
    function text_field_do_shortcodes($value, $post_id, $field) {
      return do_shortcode($value);
    }