[Resolved] Selector in Connect existing Object (from relationship) does not load titles
This thread is resolved. Here is a description of the problem and solution.
Problem:
When trying to connect existing posts the post selector is full of blank entries.
Solution:
The client is creating posts without titles. The post selector in the relationships UI uses the post title to choose posts, and so the post title must be present.
This support ticket is created 5 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
I believe this issue arises when CPT in relationship does not have wp-post-title. This is a problem, because customer has a set of custom fields with Title of object is defined as a custom text field.
Question: how can I get that custom Titles from that fields in select UI for "Connect existing [something]"?
No, posts are created from admin part. Are "post titles" obligatory and not replaceable? If yes, it seems I have to find way to auto-generate them. Is there a way to auto-generate post titles on existing posts from custom field?
Post titles are only obligatory inasmuch as that's what is used in the post selector for identifying posts. It's pretty unusual for posts to not have a title at all.
So, yes, you'll want to auto-generate titles based on the custom field.
If you have existing data to update, you can add PHP at Toolset > Settings > Custom Code, which helpfully has the option to run code one time only.
So you can run a batch job that gets the posts that need updating (get_posts), iterates over them and gets the custom field value (get_post_meta) and then updates the post (wp_update_post).