Home Forums General Issues Relationship Field Filter by \'last_name\' Reply To: Relationship Field Filter by \'last_name\'

  • So to be clear….

    “If you skip trying to order them by the fields that would work.”

    I’m sorry but that confuses me somewhat. Are you saying John that my only real option in using the “acf/fields/relationship/result” filter is to return IDs?

    In the meantime I did try out the result filter and as you can see it is pulling the “LAST_NAME, FIRST_NAME” FIELDS (see attached pic).

    So is it possible for

    1) Remove the Post Title so only my query results are showing?
    2) Order on the Query

    function my_relationship_result( $result, $object, $field, $post )
    	// load a custom field from this $object and show it in the $result
    		$lname = get_field('last_name', $object->ID);
    		$fname = get_field('first_name', $object->ID);
    		$result .= ' [' . $lname . ', ' . $fname . ']' ;
    		return $result;
    add_filter('acf/fields/relationship/result/key=field_565de210b1c8c', 'my_relationship_result', 10, 4);