Home Forums Feature Requests Relationship field resize


Relationship field resize

  • It would be really useful to be able to change the height of the relationship field by dragging in the bottom-right corner. If I am relating a post to many other posts it can be a bit fiddly to reorder them within the small area currently available.

    Also it would be good if the post added/edited date could show next to its title in the relationship field. This would make it easier to find specific posts.


  • I can’t help you with the field size, but there is a filter in ACF that will let you alter what is displayed for each post.

  • Thanks John. I gave the filter a go and it is quite useful for altering what is displayed, but the search input in the relationship field does not seem to search on the amended text which limits its use.

    Also for whom it may concern, I think there is a mistake in the example code at Instead of returning $result I believe the function should be returning $title.

  • The field still only searches the title and content, it basically does a standard keyword search in WP. If you want to search other fields for selecting matches in ACF you need to alter the actual query that is done in WP and you need to alter the search portion of the where clause of the query. See

  • Thanks John. I’ll look into this. The resizing of field is probably more important to me so hopefully Elliot will consider adding this feature.

  • Hi Dave

    I’m not sure if there is a way to make an ACF relationship field bigger on an individual basis, but since I needed the same thing for all of mine, I simply insert a pretty dirty hack into the WordPress admin like so:

    function custom_acf_css() {
        echo '<style>
            .acf-relationship .list {
                height: 510px !important;
    add_action('admin_head', 'custom_acf_css');

    This inserts some custom CSS applied to the class around the relationship field. It needs to go into your functions.php file.

    Adjust to your liking!

    On another note regarding filtering, I once had a case where a client only wanted to select items younger than a year. I used something like:

    function acf_relationship_filter( $args, $field, $post_id ) {
        $args['post_status'] = array('publish');
        $args['date_query'] = array(
            'after' => date('Y-m-d G:i:s', strtotime('-1 year')),
            'inclusive' => true
        return $args;
    add_filter('acf/fields/relationship/query/name=featured_items', 'acf_relationship_filter', 10, 3);

    ‘featured_items’ in the query string on the filter was the name of my ACF field. Adjust to your liking or use this as a basis to setup your own filtering of some kind.

    Hope this helps someone!

  • @kapitaine I wouldn’t consider the CSS a “dirty hack”, I do it all the time. Although I might be more specific with my targeting to only include the field I was interested in changing.

    /* to target a specific field with css 
       change the date key to the field key of your field */
    [data-key="field_09876543"] .list {
      /* styles here */

    CSS is created so that styles that come later are allowed to override what’s already been done. You’re just taking advantage of the “Cascading” in “Cascading Style Sheets”

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Relationship field resize’ is closed to new replies.