Support

Account

Home Forums Feature Requests relationshipfield with direct link to post Reply To: relationshipfield with direct link to post

  • Hi @nicmare,

    Have you tried using the acf/fields/relationship/result filter to add the link to the post on the text that displays for each post.

    The code is simple, it should be as follows:

    add_filter('acf/fields/relationship/result', 'my_relationship_result', 10, 4);
    
    function my_relationship_result( $result, $object, $field, $post ) {
        
        $link = '<a href="'.get_permalink($object->ID).'"">Link text</a>';
    
        $result = $result . ' ' . $link;
    
        return $result;
    }

    Have a look at acf/fields/relationship/query for more information.