I have "endorsement request" parent post type and a "endorsement" as a child post.
My endorsement is created and it is linked to the endorsement request. They are both in a O2O relationship.
As per documentation, I should be able to find parent id in the custom field _wpcf_belongs_endorsement-request_id. But that custom field does not exist when I search wp_postmeta table. In fact, this query (SELECT * FROM wp_postmeta where meta_key LIKE '%_wpcf%belong') returns no rows.
Use case: get a list of all endorsements that are published and have a parent that is created by the current user.
Documentation:
https://toolset.com/forums/topic/meta-for-post-relationships/
https://toolset.com/forums/topic/where-are-custom-fields-stored-in-the-database-wordpress-custom-query/
What am I missing here? Has the location for parent post id changed?
More info:
The endorsement is published by an unregistered user using a custom link. The urlparam for the parent endorsement request is used to populate the parent relationship in the endorsement form. You can see in the screenshot that the endorsement has a parent endorsement request linked to it.
Hello,
You are referring outdated threads, I assume you are going to get related posts using custom PHP codes.
Please follow our document to setup your custom PHP codes :
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post
If there are multiple related posts(O2M and M2M relationships), please check function toolset_get_related_posts()
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
And the post relationship data are saved in your database tables:
- wp_toolset_associations
- wp_toolset_relationships
- wp_toolset_connected_elements
Luo,
Thanks for the information. This worked perfectly well. It would be great to remove or flag outdated threads as I spend a lot of time looking at those before filling a ticket.
My issue is resolved now. Thank you!