Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_relationship_result( $title, $post, $field, $post_id ) {
- // load a custom field from this $object and show it in the $result
- $page_views = get_field('page_views', $post->ID);
- // append to title
- $title .= ' [' . $page_views . ']';
- // return
- return $title;
- }
- // filter for every field
- add_filter('acf/fields/relationship/result', 'my_relationship_result', 10, 4);
- // filter for a specific field based on it's name
- //add_filter('acf/fields/relationship/result/name=my_relationship', 'my_relationship_result', 10, 4);
- // filter for a specific field based on it's key
- //add_filter('acf/fields/relationship/result/key=field_508a263b40457', 'my_relationship_result', 10, 4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement