Some relationship titles missing from select query
Support › MB Relationships › Some relationship titles missing from select query
- This topic has 4 replies, 2 voices, and was last updated 3 years, 9 months ago by
Long Nguyen.
-
AuthorPosts
-
December 30, 2021 at 9:10 AM #32916
papertower
ParticipantWe 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.
Any ideas?
December 30, 2021 at 9:17 AM #32917papertower
ParticipantOh, 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', ], ], ]);December 30, 2021 at 10:11 PM #32936Long Nguyen
ModeratorHi,
The field type
select_advancedonly supports showing 10 items then showing more when scrolling down. Get the details here https://docs.metabox.io/fields/post/#ajax-loadPlease try to use the field type
selectand 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' ] ],December 31, 2021 at 8:30 AM #32944papertower
ParticipantSo 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
select_advanced?December 31, 2021 at 3:24 PM #32947Long Nguyen
ModeratorHi,
Use the field
selectjust to check the post titles if they work with this field. Can you please do a test? -
AuthorPosts
- You must be logged in to reply to this topic.