Support

Account

Home Forums Backend Issues (wp-admin) ACF Relationship field loading very slowly Reply To: ACF Relationship field loading very slowly

  • Hi @rafaella_souza

    The slow issue occurs because ACF needs to load a lot of posts to list it in the relationship field. What you can do is limiting the returned posts so it won’t need a lot of time to load. You can do it by using the “acf/fields/relationship/query” hook to modify the query. It should be something like this:

    function my_relationship_query( $args, $field, $post_id ) {
    	
        // only show children of the current post being edited
        $args['posts_per_page'] = 3;
    	// return
        return $args;
        
    }
    // filter for every field
    add_filter('acf/fields/relationship/query', 'my_relationship_query', 10, 3);

    This page should give you more idea about it: http://www.advancedcustomfields.com/resources/acf-fields-relationship-query/.

    You can also check the core code for any hook that allows you to customize the relationship field.

    I hope this helps.