Home Forums Feature Requests Relationship field resize Reply To: Relationship field resize

  • 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!