Hello!
I'm using the Fluent Forms plugin to let users place reviews on the frontend. The form creates post in the post type 'reviews', which is in a post relationship with the page where the form is shown. Connecting the types custom fields with the form works great, but setting up the post relationship is a bit more complicated. I can use the post ID where the form is shown as meta value, but I'm not sure which meta key to use to connect the review to the right page.
What meta key do I have to use to achieve this?
Thanks a lot for your help in advance 🙂
Hi,
Thank you for contacting us and I'd be happy to assist.
The updated post relationship feature that was introduced in Type 3.0, no longer relies on custom field values to store the related post's information.
To programmatically connect posts in a relationship, the "toolset_connect_posts" function can be used:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_connect_posts
You can consult the Fluent Forms plugin's documentation or support team, to see if it offers any hook that can be used to process this function, whenever the review form is submitted.
If you're open to a solution that doesn't use a post relationship feature between the pages and review post types, you can simply create a new custom field in your review post type and store the ID of the current page, in that to form a connection.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Hello Waqar,
Thank you for your fast reply!
That's great, I didn't think about the option of creating a relationship with a custom field. I saved the post id in a new custom field, and created a view filter with a shortcode attribute in which I pass the post id of the page where the view is shown. This works great.
Thanks for your support 🙂