Support Forum
Support › MB Custom Post Type › Hierarchical Post Type causes 404
Hi there,
I'm creating a wiki site using Bricks builder and Metabox. For this I have multiple CPT's, Relationships and Taxonomies set up. I'm also using the "Custom Post Type Permalinks" plugin to make permalinks a bit more attractive to the eye.
For the CPT "Skill" I enabled the option "Hierarchical". This is because some skills have sub skills. Which I want to indicate with the parent / child system.
This is where the problem starts to arise. Whenever I enable this option and updating the permalinks (twice to also flush) the page's stop working completely. I've spent a lot of time debugging and trying to pinpoint the issue but to no avail.
I noticed that this was also the case with the other CPT's, that when I enabled the "Hierarchical" option, it just stopped working on the front end.
Things I've tried:
I cannot figure out where the problem originates from aside from the Hierarchical option.
Help is highly appreciated!
- Roel
Hello Roel,
You can try to deactivate the custom permalink plugin, re-save permalink settings (post name) or create a new CPT with the same settings to see how it goes.
Hi Peter,
Thanks for your reply. Please note the text "Things I've tried" and it's points.
I've already tried your suggestions.
Kind regards,
Roel
Hi Roel,
Do you mind sharing the URL of any post of your CPT type where the problem can be seen?
Just tested and it works fine for me.
Ignore the time-wasting I did in the 1st video. I had a brain fade and forgot how to get the "<CPT> Attributes" meta box to appear when editing the entries.
https://app.usebubbles.com/i1vGXmJxCGEvovmMe5j4NK/hierarchical-cpt-1
https://app.usebubbles.com/jveQjdv1azKsuhpGGAJhTD/hierarchical-cpt-2
Hmmm super strange.
Here's a full set up of my CPT and Character relationship:
https://imgur.com/a/8Bc2gin
I'm not sure where it goes wrong, but even after disabling the permalink plugin it doesn't work.
You wrote:
This is where the problem starts to arise. Whenever I enable this option and updating the permalinks (twice to also flush) the page's stop working completely.
Can you share a screencast showing the same?
You want a screencast of me showing when it stops working?
yes and also your Bricks template setup/structure and template condition.
Hello Roel,
Sorry if this is confusing for you. I mean creating a new CPT with a different slug and the same settings to see if it works.
MB Custom Post Types and Taxonomies use the UI to create the CPT as you do when registering the CPT with code https://developer.wordpress.org/reference/functions/register_post_type/
So I think it isn't an issue of Meta Box itself. You can try to deactivate all plugins except Meta Box, MB extension plugin, switch to a standard theme of WordPress and use the function flush_rewrite_rules()
at the init
hook to see if it helps.
https://developer.wordpress.org/reference/functions/flush_rewrite_rules/
Also, thanks for your support, Sridhar.
Hi Sridhar,
Here is the video you requested:
https://streamable.com/izgluh
Hopefully my set up makes some sense.
I've played with all the possible checkboxes, but to no avail.
- Roel
"This site can’t provide a secure connection
streamable.com sent an invalid response.
ERR_SSL_PROTOCOL_ERROR"
Also, do not forget answering https://support.metabox.io/topic/hierarchical-post-type-causes-404/#post-43684.
Sorry! I thought I already answered #43684.
Here are links where the issue can be seen:
Parent post
Child post
Strange that the streamable link doesn't seem to work for you.
Maybe try this link instead:
https://streamable.com/izgluh?t=0&src=player-page-share
Thanks for your replies!
The answer has been found by Anh Tran.
The CPT option: Query var needs to be enabled, after this the CPT Permalinks plugin needs to be disabled and permalinks need to be saved twice.
The CPT Permalinks plugin does not handle child CPT's well. However, this didn't explain the post still not working after disabling the plugin, that issue lays in the Query var option.
Hello,
Same issue with hierarchical pages, only solution was not to use metabox to do it and handle my pages hierarchical structure using the post type type SLUG as a repertory name, Prepended permalink structure and Enabling request the post via URL. In that case the rewrite rule works without getting 404 errors for pages that were already fine in this repertory before using metabox for other pages. Trying anything else either makes pages not built with metabox go in 404 or new pages built with metabox go on 404. No way to get both running fine before, now it is ok but required couple of days to get right.