Skip Navigation

[Resolved] Many to Many Post Relationships – Consistent behavior when a Parent is deleted?

This support ticket is created 6 years, 11 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 2 voices.

Last updated by GTD9219 6 years, 11 months ago.

Assisted by: Beda.

Author
Posts
#595168

I have been experimenting with this, but am struggling see consistent behavior.

Context
I have 3 CPTs configured in a many-to-many Post Relationship: People, Relations (for recommendations), Books.
Relations has two parents: People & Books.

Simple Configuration (my site is very similar to the Bands, Events, Appearances example): Person Pages shows recommended Books, Book pages show People that have recommended them).

I have read through any many-to-many related documentation pages I could find:
- https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/
- https://toolset.com/documentation/beyond-the-basics/post-relationship-concepts/implementing-many-to-many-relationships/
- https://toolset.com/documentation/user-guides/many-to-many-post-relationship/

Question
The Parents CPTs, People and Books, generate the relations-XXX posts when relationships are created.

If one of the the Parent CPT Posts are deleted, are the corresponding Relations Posts deleted? If not, are "orphaned" relations posts caused... which can cause problems with Views?

For example if Person Post: John Doe "recommends (post relationship with Relations Post: relations-XXX) Book Post: The Lord of the Rings... and John Doe or The Lord of the Rings are deleted... if the "relation-xxx" post is NOT deleted... an erroneous link to could exist.

Hopefully this makes sense.

#595278

No Post is deleted but the one you delete.

This means, if you delete any of the posts in such a tri-relation, the other 2 stay.
In Views Loops you will check upon the existence of the Parent, to avoid wrong links:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

You will check if the parent Post Field is not empty, and that avoids outputting empty data.

#597429

Ok. Thanks