Skip Navigation

[Resolved] Nested custom post types 404

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 8 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

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 Beda 8 years, 3 months ago.

Assisted by: Beda.

Author
Posts
#360939

I am trying to:
I have 3 different custom post types in my website, lets say they are, school, teacher and exercise. The following link works as supposed: hidden link
School should be parent of teacher, and teacher be parent of lesson.
I visited this URL:
Types returns a permalink like this
hidden link
I expected to see:
The teacher profile
Instead, I got:
404

#360989

By default, unless you modified the URL Rewrite (prefixing) in Types > Custom Post Types, every post type should return what you set in WordPress > Settings > Permalinks.

That means, if your CPT "Schools" returns hidden link
also the Teacher Post Type will return hidden link

I need to see your setup, if the below steps don't work:

1. Resave your Permalinks
2. Ensure a clean Permalink field and setting in Types > Custom Fields > your_cpts > Edit > Options > Use the normal WordPress URL logic
3. Ensure that you are not using a URL Rewrite custom code or Plugin
4. Check if a new default post of this type also leads to a 404
5. Check if the issue also persist with Theme Twenty Fourteen and NO Plugins BUT WPML + AddOns?

If not, could you then re-enable the Plugins one after the other, and check the issue each time you enable a plugin?
Please report me when the issue comes back
It might also be due to the Theme.
Please do reactivate your Theme only after you are sure the issue isn't coming form a 3rd Party Plugin.

Otherwise I will need to ask for access.
- preferably to a test site where the problem has been replicated if possible -
in order to be of better help and check if some configurations might need to be changed

Your next answer will be private which means only you and I have access to it.

❌ Please backup your database and website ❌

✙ I would, if possible, need access to a site where only a minimal set of Plugins and a default theme is active.
This to avoid eventual compatibility issues with other software.

✙ Please add the Links to:

- The Post Type Edit Screen

- Example Posts

Thank you for your patience.

#361480

Hierarchical has not to be set to true to use TYPES posts relationships, but only to use WordPress Relationships as you know it from Pages.

So if you want a Post Type to be parent of another, you just need to set that in Types > Custom Types > your_cpt > Edit > Post Relationships

Hierarchical can be left default (false)

You seem though to use both?

To update the TYPES post relationship programmatically all you need to do is update the post meta field _wpcf_belongs_{parent-post-type-slug}_id of the CHILD Post with the ID of the parent post.

So that means when you submit a new Child Post (usually we do it with CRED, where we have a extra field for that), you have to know the parent posts ID and then address the Custom Field above mentioned and update it with that ID.

The URL should not change, and did not, in my local test.
The URL does not determine our Types Post Relationships

Is that what I describe above also what you try to achieve?

Thank you

The forum ‘Types Community Support’ is closed to new topics and replies.

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