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 );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.