Support › MB Relationships › Some relationship titles missing from select query
We have a relationship between Doctors and Locations. On the Location side we have "Doctors at Location": https://share.getcloudapp.com/yAukWXew
You'll notice that many of the select fields are blank in that screenshot. The relationship is working just fine, and if I query the location in wp_mb_relationships I see all the IDs in place. I can also confirm that the relationships go to real doctors; I can even see the Location from the other side: https://share.getcloudapp.com/o0uZjN1K
When I click on the dropdown and type in the missing doctor's name, nothing pops up. So it seems like the query is perhaps being limited and there are more doctors than it queries (i.e. posts_per_page). I tried adding the following to the relationship, but it didn't seem to help:
'field' => [ 'query_args' => [ 'numberposts' => -1, ], ],
As a note there are ~250 doctors.
Oh, and here's the relationship:
MB_Relationships_API::register([ 'id' => get_relation_id(DOCTOR_TYPE, LOCATION_TYPE), 'from' => [ 'object_type' => 'post', 'post_type' => DOCTOR_TYPE, 'meta_box' => [ 'title' => 'Available at locations', ], 'admin_column' => true, ], 'to' => [ 'object_type' => 'post', 'post_type' => LOCATION_TYPE, 'meta_box' => [ 'title' => 'Doctors at Location', ], ], ]);
The field type
select_advanced only supports showing 10 items then showing more when scrolling down. Get the details here https://docs.metabox.io/fields/post/#ajax-load
Please try to use the field type
select and let me know if the post title (Doctor) is still missing.
'to' => [ 'object_type' => 'post', 'post_type' => LOCATION_TYPE, 'meta_box' => [ 'title' => 'Doctors at Location', ], 'field' => [ 'field_type' => 'select' ] ],
So that means all 250 doctors would show up in a standard select dropdown? Sounds like a terrible UX. Is there a way to load all of them, or some better experience for the
Use the field
select just to check the post titles if they work with this field. Can you please do a test?