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
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"
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)
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
What could be cousing it not to work on that live server ,
maybe something is missing on server
I must underline that this works on my WAMP instalation without the problem
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/
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
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');