Home › Toolset Professional Support › [Resolved] Hierarchical URL's not working (404) on child taxonomies URLs
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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
Tagged: Setting up custom taxonomy, Types plugin
Related documentation:
This topic contains 13 replies, has 2 voices.
Last updated by Nigel 4 years, 6 months ago.
Assisted by: Nigel.
Tell us what you are trying to do?
I have a taxonomy called 'States' which contains each US State, then child taxonomies of each City in each State, Taxonomy Structure:
State (state) URL Prefix: in
Alabama - URL: .com/in/alabama
--- > Birmingham - URL: .com/in/alabama/birmingham
--- > Cullman - URL: .com/in/alabama/cullman
The States work, "ex: .com/in/alabama" with a custom Archive page just fine, within the wordpress backend, the URL's generate as above for the Child taxonomies, but the pages 404.
URL's only work unstructured: .com/in/birmingham/ works.
I want the URL's to work as above, .com/in/alabama/birmingham, wordpress is trying to get this to work, but the rewrites are clearly not hierarchical
Taxonomy options, Rewrite, Hierarchical URLs, Allow permalinks to be prepended with front base, are all checked.
I have tried numerous solutions, functions.php changes, and more, to no solution.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Nick
I just tried the same on a local test site and it's working as expected.
My taxonomy settings you can see in the screenshot.
This gives me archive URLs such as
site.com/in/texas/
site.com/in/texas/austin/
and they all display correctly.
I made no changes to the default permalink settings.
I suggest after reviewing your settings you disable all plugins except Types and switch to the twentytwenty theme and test once more. (If you have any custom code snippets added at Toolset > Settings > Custom Code then disable them.)
Does it work in this base scenario?
If so then some conflict would be causing the 404s, and it should be possible to identify what by a process of elimination.
Let me know what you find.
DIsabled all plugins (except Toolset Types) and cleared all cache's, still the same issue. Then switched to twentytwenty, same issue. Went back and enabled each plugin one by one, then went between Astra Pro and twentytwenty, same issue.
I don't have an excess of customizations or 'weird' plugins, basically the standard Astra, Rankmath, Admin Columns Pro, WP Forms, and a Gutenberg Addon, no code has been changed for Toolset or functions.php, and everything is up to date including wordpress. The server is a litespeed standard server and only customizations have been upload size and execution time.
The only thing I noticed through this trouble shooting is there are two 404 pages, one is titled 'Page Not Found' the other is 'Page not found', but that just shows redirects and 404's are working, and probably Astra has it's own 404 enabled somewhere.
Any other insight would be greatly appreciated!
.com/in/texas/ - works
.com/in/texas/austin/ - 404 page
.com/in/austin/ - works (as the austin texas filter)
Settings > Permalinks: 'Day and name'
With 'Plain' enabled it doesn't work at all, as assumed.
These child taxonomies were created using an import (import of all other data works just fine), but I manually created a child taxonomy, ex: .com/in/alabama/test-city/ and this also 404's.
I unchecked the hierarchical option, saved, then rechecked it, and saved again, in hopes to clear out any things I don't understand could be broken, this also has no effect.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Could I get a copy of the site so that I can install it locally where I can perform some further debugging?
hidden link
I’d prefer giving you an admin login if at all possible?
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Sure, I'll set your next reply as private to get site credentials from you.
Be sure you have a current backup.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Nicholas
I took a copy of your site and installed it locally, then disabled all plugins except for Types, where I was able to see the problem.
I found that the issue occurs because you disabled the query_var option in the taxonomy options. Enabling it, and resaving the permalinks fixes the issue with the hierarchical URLs.
I checked on a local test site and found the same, that that setting needs to be checked.
I updated your site where it is now working.
The entire front end now 503 errors. I’ll check the logs. Hopefully it’s a quick fix
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
I just checked again and it appeared to be working fine, I can visit the same URLs we've been discussing and they display okay.
But then I logged-out to check, and, yes, I see 503 errors.
I was only using the site while logged-in so I'm not sure when that started.
On your live site all I was doing was changing the settings for the custom taxonomy and resaving the permalinks.
Hopefully there are clues in the logs.
Nothing in the logs beyond warnings and debug things, site's been down for a bit now, had another developer (server admin) go in, and he couldn't fix it either.
To UpWork I go, or I revert back to non-working hierarchical URLs!
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
I checked just now and those URLs appear to be working correctly now (e.g. hidden link), but I also note on the texas page that I can see unparsed Toolset shortcodes, which makes me think that Views/Blocks are disabled.
Did someone identify it as the problem?
The solution with enabling that checkbox to get the hierarchical URL's to work, caused a series of issues with the server, currently using Open LiteSpeed, so that had to be reconfigured.
Once that was resolved, any content block or view which contains short codes that pull those parent/child URL's using codes found on this forum, to get parent state on city page, or parent state slug on custom post page, sometimes eat up all memory until the server ends itself, which is yet another issue I'm working out on my own, but is unrelated to this.
Now, for URLs: there are still some issues as the redirects are confused between matching city names, though are within different states:
.com/illinois/lake-view/
.com/florida/lake-view/
Will go to whichever state name comes first alphabetically (they were created A-Z so probably something with tax ID), obviously this is not ideal 🙂 Not sure if this warrants an additional ticket or is related to this issue.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
I did some more testing on my own site to check this, without using Toolset at all and simply registering a custom taxonomy using the normal WordPress register_taxonomy function (https://developer.wordpress.org/reference/functions/register_taxonomy/).
When you register a taxonomy using Types it is just providing a UI for that function, so I wouldn't expect the experience to be any different when using a Types registered taxonomy than a taxonomy directly registered with WordPress, but wanted to rule out that Types affects this somehow.
Take a look at the screenshot, where I've been setting up some test taxonomy terms similar to your own.
I was entering new terms on the left, adding the Name but leaving the Slug blank for WordPress to auto-generate.
And you'll see that when it came to adding Lake View in Illinois (after I had already registered Lake View in Florida) it auto-generated a slug lake-view-illinois, i.e. it recognised the clash that would arise from having two terms with the same slug and prevented that.
Note that when I tried again, this time explicitly trying to use the same slug (lake-view), it wouldn't let me, and automatically changed it again to append the top-tier term.
I'm not sure how you managed to create terms with the same slug in the first place because it shouldn't be possible.
The way WordPress rewrite rules work, including the hierarchy is for appearance's sake in any case, only the final slug is used to determine the archive to display. You can see that by trying some garbage URL such as site.com/location/florida/bogus/nosuchplace/pluto/miami/ and it will still display the miami archive.
This is all without Types, it's just how WordPress works.
You could go down the route of crafting your own custom rewrite rules (see https://developer.wordpress.org/reference/functions/add_rewrite_rule/, and try a search for wordpress custom rewrite tutorial), but that's outside the scope of support and independent of whether you use Toolset or not.