Skip Navigation

[Resolved] Change CPT relationship from 1 to many to many-to-many

This thread is resolved. Here is a description of the problem and solution.

Problem:

The customer wanted to change an existing Toolset relationship from one-to-many to many-to-many so one event could be connected to multiple partners, and wanted to know whether this could break existing relations.

Solution:

The change is possible, but it should be done carefully on a staging site. Existing event-partner connections need to be checked after the change, and any Views, Forms, templates, or custom code depending on the old one-to-many structure may need updates. It was also noted that many-to-many setups may require an intermediary post type when relationship fields are needed.

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.

This topic contains 1 reply, has 1 voice.

Last updated by Christopher Amirian 1 week, 3 days ago.

Assisted by: Christopher Amirian.

Author
Posts
#2862155

I have a client setup with a couple CPT setup and some relationships. The main feature is a list of events created in collaboration with several partners. In origin Each event could only have a single partner but now they would like to change this and have multiple partners collaborate to a single event. The relationship is therefore changing from 1-to-many to many-to-many.

Is it possible or do I run the risk of breaking current relations?

#2862201

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Welcome to Toolset support:

I would not recommend changing this as you will need to check many possible problems:

- existing Event → Partner connections should be checked after the change
- any Views, Forms, templates, or custom code that depend on the old one-to-many structure may need updating
- many-to-many relationships may use an intermediary post type if you need relationship fields

So I would say it is possible but you need to do it with caution on a staging/copy version of the website and see if it works on your use case.

Thanks.