Skip Navigation

[Resolved] Child custom post type of the custom post type have 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 6 years, 7 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 8 replies, has 2 voices.

Last updated by Luo Yang 6 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#568604

I am trying to:
to make custom post type child to another custom post type like so
domain/locations(CPT slug)/city(CPT1-locations)/service(CPT-services)

For CPT-locations I use custom slug format and empty field .

For CPT-services I use custom slug format locations/halifax/ so they can be linked only to Halifax city , there for I would make for every city new CPT , which is fine for me.

This works on my localhost where I have regualar WAMP but it doesnt work on my server, it gives me 404 for test page

Link to a page where the issue can be seen:
bustmold.com/locations/halifax/test/

I expected to see:

While I expected to see regular template page for this page which works fine if I dont use this custom url format for CPT-services

Instead, I got:

where i get 404 on this page
bustmold.com/locations/halifax/test/

Can you help me plz
Luka

#568644

Dear Luka,

There isn't such a built-in feature within Types plugin, and it is not recommended to setup such kind of permalink structure as you mentioned above:
domain/locations(CPT slug)/city(CPT1-locations)/service(CPT-services)

WordPress does not support such kind of permalink structure by default, are you using some custom codes to make it working in your localhost?
and if it is working in your localhost but not working in your web server, you should contact your server provider for it.

In my opinion, I suggest you merge both custom post types (locations and services) into one custom post type with Types plugin,
https://codex.wordpress.org/Function_Reference/register_post_type#hierarchical
For example, when you create/edit a custom post type
a) in section "Sections to display when editing ", enable option "Page Attributes"
b) In section "Options", enable option "hierarchical"

Then you will be able to achieve the permalink structure as you want, just like the wordpress built-in post type "Page"

#569035

i need this url structure domain/locations/city/services/
becouse of SEO purposes
is there any other way that this can be achieved?
if I can keep only one CPT (city)

#569048
Edit-Post-Type-‹-Bustmold-—-WordPress-(4).jpg
Edit-Post-Type-‹-Bustmold-—-WordPress-(3).jpg

I haven't used any custom code in this case ..
just wp-types options and it really works in on local
will upload images of the cpt settings

#569051

What could be cousing it not to work on that live server ,
maybe something is missing on server

#569102

I must underline that this works on my WAMP instalation without the problem

#569112

In your screenshot:
https://toolset.com/wp-content/uploads/2017/09/569048-Edit_Post_Type_Bustmold_WordPress_4_.jpg?x71388

The option "Rewrite" is: locations/halifax
It is a static rewrite rule, that means all the single "city service" posts are using same permalink rule, for example:
hidden link
hidden link
...

It does not work as you expected:
domain/locations(CPT slug)/city(CPT1-locations)/service(CPT-services)
you can simply try it in your localhost.

As I mentioned above, there isn't such a built-in feature within Types plugin, if you agree, we can take it as a feature request, our developers will evaluate it, currently, you can also check out our certified partners for it:
https://toolset.com/consultant/

#569123

ok, I see ..
the strange thing is that this is working on my localhost
hidden link
hidden link
this is what I was looking and got working on local only unfortunate
the reason not known at the moment

#569151

Are you going to setup as below? please confirm it first:
all the single "city service" posts are using same permalink rule, for example:
hidden link

This is possible with Types plugin, if above rule does not work in your live website, it might be a compatibility problem or server problem, which I can not duplicate same problem please check these:
1) Dashboard-> Settings-> Permalinks
choose an option like this "Post name"

2) Deactivate other plugins (except Types plugin) and switch to wordpress default theme 2017, and test again

3) Enable PHP debug mode, copy and paste the debug logs here, we need to know if there is any PHP error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/
PHP Debugging
To enable PHP debugging in WordPress, edit your wp-config.php file and add the following:
PHP Debugging in WP
ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');

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.