Filters the text displayed for each post in the Relationship field.


  • Added in version 4.1.2


apply_filters( 'acf/fields/relationship/result', $text, $post, $field, $post_id );
  • $text (string) The text displayed for this post (the post title).
  • $post (WP_Post) The Relationship.
  • $field (array) The field array containing all settings.
  • $post_id (int|string) The current post ID being edited.


This filter provides modifiers to target specific fields. The following filter names are available:

  • acf/fields/relationship/result Applies to all fields.
  • acf/fields/relationship/result/name={$name} Applies to all fields of a specific name.
  • acf/fields/relationship/result/key={$key} Applies to all fields of a specific key.


This example demonstrates how to append a custom field value from each post to the text displayed.


add_filter('acf/fields/relationship/result', 'my_acf_fields_relationship_result', 10, 4);
function my_acf_fields_relationship_result( $text, $post, $field, $post_id ) {
    $page_views = get_field( 'page_views', $post->ID );
    if( $page_views ) {
        $text .= ' ' . sprintf( '(%s views)', $page_views );
    return $text;

Black Friday Sale 🎉 Get 30% off new licenses and 15% off early renewals!
Coupon expires Dec 1st (11:59pm GMT) - don't miss out!

* Discounted subscriptions will renew at their full price. Cancel at any time.

Coupon Code

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.