Home › Forums › General Issues › Use value from field in another group › Reply To: Use value from field in another group
I’ve found this and it works fine. The field donations is a Post Object field and in functions.php I’ve added this code:
<?php
function my_post_object_result( $title, $post, $field, $post_id ) {
// load a custom field from this $object and show it in the $result
$page_views = get_field(‘achternaam’, $post->ID);
// append to title
$title .= ‘ [‘ . $page_views . ‘]’;
// return
return $title;
}
// filter for every field
add_filter(‘acf/fields/post_object/result’, ‘my_post_object_result’, 10, 4);
?>
One more question though.. when I fill in the field Donation I can only search on post_id, not on the custom field.
Any ideas?
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.