I recently started using Relationship field in my project. Its a basic usage: find and add post by title. But what I notice is that this field in backend post editing page takes a long time to load up and when its not the only field loading (i.e. using Post Object fields too), those requests are added to queue. I would like to make that Relationship field would only load results when searched.
There is this acf/fields/relationship/query filter, but I am not able to think how to use it. My one idea was to check if search argument is empty and if so, simply cancel the query. But how?
You would need to alter the query to something that you know will return no results. Query for a meta value that does not exist or something like that. But this will not really improve much. The AJAX request would still be run, the query would still be performed and results (empty) still returned from the request. These things will still consume time.