Skip Navigation

[Resolved] Incorrect post type when connecting posts (Types Version 3.0-RC2)

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

Problem: I'm trying using the Post Relationship panel of the Custom Post Type editor to connect to an existing standard Post, but I see the titles of another Custom Post Type called "Offices". I'm using the new Types 3.0-RC2.

Solution: In this case, it appears that the Property Hive plugin has a post type "Offices" that uses the label "Posts", so the Post Relationship was actually set up using the wrong post type. Creating the Post Relationship again using the proper Posts post type solved the problem.

This support ticket is created 5 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by Chris 5 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#846849

I have created a many-to-many relationship between two post types, 'Housing Developments' and 'Posts'. I haven't created an intermediary post type. (The relationship slug is 'housing-development-post'.)

When I edit a Housing Development and try to connect it to an existing post, the modal dialog Connect Existing Post shows me the titles of a completely different post type ('Offices'), rather than the posts I want - so there's no way of setting the connection correctly.

If I try creating a new post, instead of connecting an existing one, I see the message "A new Post has been connected to this Housing Development", but it doesn't create a standard Post, it creates a custom post of post type 'office'.

I took a look at the wp_toolset_relationships table in the database, and I can see a row for the relationship, but the 'child_types' field appears to be set wrongly there - it doesn't match 'set_id' in the 'wp_toolset_type_sets' table which is assume it should.

In addition, once the new post has been created, it appears in the list, with the usual action links appearing below it. However when I click on 'Edit' this simply takes me back to editing the parent Housing Development (ie the Edit link contains the post id of the parent post, rather than the id of the newly created post). Note that the 'Office' post type is created by another plugin, and it isn't editable through the normal interface, so perhaps that's causing the latter issue.

I'd be grateful if you could take a look at what's going on here.

Many thanks,

Chris

#847842

Hi, I can see that no intermediary post type exists here:
hidden link
Is it possible the intermediary post type was deleted? It shouldn't be possible to finalize a m2m relationship without an intermediary post type. Regardless, it's probably best at this point to delete the entire relationship and recreate it.

Please try this first, then we can run some other troubleshooting steps if you continue to experience this problem with a new relationship.

#853864

Hi Christian,

Yes, you're right, there was no intermediary post type. I didn't delete it though: the wizard actually gives a checkbox to select whether or not to create one, so I assumed it wasn't required (on the "Names" screen). If it is required for many-to-many relationships, then that checkbox needs to be disabled.

Anyhow, I have deleted the relationship and recreated it, this time with the intermediary post type (and I've selected the option to show that in the admin menu). However the problem remains the same - the relationship is being created with the wrong post type.

Could you take another look?

Many thanks,

Chris

#857662

I'm a bit confused because I'm not sure where this "Offices" post type is coming from. It could be a post type created by another plugin or the theme, which is causing a conflict. As a test, please deactivate all plugins except Types and activate a default theme like Twenty Seventeen. Then try to connect a Post to a Housing Development like before. Are the correct posts shown in the search menu now?

#866048
Screen Shot 2018-05-09 at 09.39.22.png
Screen Shot 2018-05-09 at 09.19.56 (2).png

Yes, that's right, "offices" is a custom post type created by another plugin (called "Property Hive").

OK, I've deactivate all the other plugins and switched to Twenty Seventeen. Now, on the relationships page, I see a warning "office post type does not exist or is currently inactive", which is correct of course (see screenshot).

I then deleted that relationship and tried creating a new one, and it's working correctly: the relationship is created between Housing Developments and standard Posts, and I can connect Housing Developments to Posts in the expected way.

I then tried reactivating the Property Hive plugin, and the relationship continues to work correctly, which suggests that the problem is happening when the relationship is created.

I then tried to create a new relationship with Property Hive enabled, and I think I see where the problem lies (see second screenshot). The lists of post types actually show two different post types called "Posts", and I had been choosing the wrong one! If I select the first "Posts" the relationship works correctly.

So, the problem isn't with Types, but with the Property Hive plugin: when that's registering the "office" post type, it isn't setting the labels correctly and so the default of "Posts" is used. I'll report that as a bug to the author of that plugin.

Apologies for my confusion, and thanks for you help in getting to the bottom of this!

Best wishes,

Chris

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.