[Closed] Child custom post type of the custom post type have 404

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.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Related documentation: WordPress Custom Post Types

This topic contains 8 replies, has 2 voices, and was last updated by  Luo Yang 1 week, 2 days ago. The support staff assigned to this topic is Luo Yang.

Viewing 9 posts - 1 through 9 (of 9 total)
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

Luo Yang
Forum moderator

Supporter languages: English (English ) Chinese (Simplified) (简体中文 )

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

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

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

Luo Yang
Forum moderator

Supporter languages: English (English ) Chinese (Simplified) (简体中文 )

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

In your screenshot:
https://wp-types.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:
http://site-url/locations/halifax/post-a/
http://site-url/locations/halifax/post-b/
...

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:
http://wp-types.com/consultant/

#569123

ok, I see ..
the strange thing is that this is working on my localhost
http://site-url/locations/halifax/post-a/
http://site-url/locations/halifax/post-b/
this is what I was looking and got working on local only unfortunate
the reason not known at the moment

#569151

Luo Yang
Forum moderator

Supporter languages: English (English ) Chinese (Simplified) (简体中文 )

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

Are you going to setup as below? please confirm it first:
all the single "city service" posts are using same permalink rule, for example:
http://site-url/locations/halifax/XXXXX/

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://wp-types.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');

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘[Closed] Child custom post type of the custom post type have 404’ is closed to new replies.

Known issues and their solutions

We document known issues and their solutions in Toolset erratas. Save time by checking there first and seeing if what you are facing is a known issue. This list is kept short. We do our best to resolve all known issues with every release of Toolset plugins.

Support Policy

Toolset staff will help you use the Toolset plugins correctly, provide any information you need, help troubleshoot problems and advice on best-practices.

Please make sure to issue only one topic per each support ticket.

For more information, read our full Customer Support Policy.

Need custom programming work for your site? Check out our certified partners.