# Show Post Type and Date in ACF Relationship Results

> Adds the post type and publish date after each title in ACF relationship and post object fields, so similar titles are easy to tell apart.

- Type: PHP
- Runs: Admin only
- Category: [Custom Post Types & Fields](https://wpide.com/library/category/post-types/)
- Tags: acf, relationship, editor
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/acf-relationship-result-details/

## Code

```php
$wpide_acf_result_details = function ( $text, $post ) {
    if ( ! $post instanceof WP_Post ) {
        return $text;
    }

    $type = get_post_type_object( $post->post_type );

    return $text . ' (' . esc_html( ( $type ? $type->labels->singular_name : $post->post_type ) . ', ' . get_the_date( 'M j, Y', $post ) ) . ')';
};

add_filter( 'acf/fields/relationship/result', $wpide_acf_result_details, 10, 2 );
add_filter( 'acf/fields/post_object/result', $wpide_acf_result_details, 10, 2 );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Show Post Type and Date in ACF Relationship Results" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
