Hi there,
I’m applying a filter to my relationship field, so that it only shows pages with a certain template applied. It works quite well!
below is the argument I build with my function.`$args = array(
'order' => 'ASC',
'orderby' => 'title',
'post_status' => 'published',
'post_type' => 'page',
'meta_query' => array(
array(
'key' => '_wp_page_template',
'value' => 'my page template name.php',
'compare' => 'LIKE'
)
)
);`
The filter works 99% correctly. The only thing is a quick with the interface. The list that appears on the left hand size (below the search box), has a lazy loading thing. Each time it loads, it loads the exact same set of pages. E.g 8 pages are listed initially. I scroll to the bottom, the lazy loading kicks in and an additional set of 8 pages (the same 8 as previously) are added to the list.
As long as I keep scrolling the list keeps repeating itself.
This doesn’t seem to effect the selection or saving of the data, but it is confusing my client!
Below is the code I use to add the filter
add_filter('acf/fields/relationship/query/name=my_field_name', 'my_acf_relationship_filter_query', 10, 3);
I’m using ACF v4.2.2 on WP v3.5.2