acf-extended / ACF-Extended

🚀 All-in-one enhancement suite that improves WordPress & Advanced Custom Fields
https://www.acf-extended.com
238 stars 27 forks source link

Make Relationship objects clickable #81

Closed hicreate closed 3 months ago

hicreate commented 3 years ago

Is your feature request related to a problem? Please describe. Is there a way to make related bi-directional and non-bi-directional posts clickable in the admin screen, so that as well as being able to delete them we can navigate to that post aswell?

Screenshot attached for reference: relationship-fields

stasou commented 2 years ago

Hi. As it seems that replies from ACFE come in batches and not very regularly, you should probably try to find a way around your issue, as I did with mine.

In your case, you could use the value format callbacks, that comes from core ACF.

By using the acf-fields-relationship-result filter, you can achieve this.

For example:

// use the name of your field instead of your_field_name
add_filter('acf/fields/relationship/result/name=your_field_name', 'my_acf_fields_relationship_result', 10, 4);
function my_acf_fields_relationship_result( $text, $post, $field, $post_id ) {
    $text = '<a href="'. get_permalink($post_id) . '">' . $text . '</a>';
    return $text;
}
acf-extended commented 2 years ago

Hello,

I'm glad to see you found a way to achieve this. Since this is a feature request, there is no real incentive to answer.

As this can be achieved using the native acf/fields/relationship/result hook, that feature request can be probably archived.

For reference, note that the hook name is acf/fields/relationship/result/name=my_field, not acf/fields/relationship/result?name=my_field.

Regards.

stasou commented 2 years ago

For reference, note that the hook name is acf/fields/relationship/result/name=my_field, not acf/fields/relationship/result?name=my_field.

I updated the original answer with the correct hook name