Home › Forums › Backend Issues (wp-admin) › ACF Relationship field loading very slowly › Reply To: ACF Relationship field loading very slowly
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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.