Hierarchical Post Type causes 404
Support › MB Custom Post Type › Hierarchical Post Type causes 404
- This topic has 15 replies, 4 voices, and was last updated 1 year, 5 months ago by
frédéric Gaulbaire.
-
AuthorPosts
-
October 29, 2023 at 5:38 PM #43668
Roel Petra
ParticipantHi 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:
- Changing the theme
- Disabling all plugins except Metabox
- Cleaning the database of old versions of the skill that might be interfering with the permalink
- Recreate the entire CPT along with its Custom Fields and Custom Taxonomy
I cannot figure out where the problem originates from aside from the Hierarchical option.
Help is highly appreciated!
- RoelOctober 30, 2023 at 9:02 PM #43675Peter
ModeratorHello 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.
October 30, 2023 at 10:05 PM #43677Roel Petra
ParticipantHi 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,
RoelOctober 31, 2023 at 3:09 PM #43684Sridhar
ParticipantHi Roel,
Do you mind sharing the URL of any post of your CPT type where the problem can be seen?
October 31, 2023 at 4:29 PM #43685Sridhar
ParticipantJust 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
October 31, 2023 at 4:45 PM #43686Roel Petra
ParticipantHmmm super strange.
Here's a full set up of my CPT and Character relationship:
https://imgur.com/a/8Bc2ginI'm not sure where it goes wrong, but even after disabling the permalink plugin it doesn't work.
October 31, 2023 at 5:16 PM #43687Sridhar
ParticipantYou 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?
October 31, 2023 at 5:18 PM #43688Roel Petra
ParticipantYou want a screencast of me showing when it stops working?
October 31, 2023 at 5:21 PM #43689Sridhar
Participantyes and also your Bricks template setup/structure and template condition.
October 31, 2023 at 5:36 PM #43690Peter
ModeratorHello 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 theinit
hook to see if it helps.
https://developer.wordpress.org/reference/functions/flush_rewrite_rules/Also, thanks for your support, Sridhar.
October 31, 2023 at 6:28 PM #43693Roel Petra
ParticipantHi Sridhar,
Here is the video you requested:
https://streamable.com/izgluhHopefully my set up makes some sense.
I've played with all the possible checkboxes, but to no avail.- Roel
October 31, 2023 at 7:42 PM #43696Sridhar
Participant"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.
October 31, 2023 at 7:44 PM #43697Roel Petra
ParticipantSorry! I thought I already answered #43684.
Here are links where the issue can be seen:
Parent post
Child postStrange 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-shareThanks for your replies!
October 31, 2023 at 10:52 PM #43708Roel Petra
ParticipantThe 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.
November 17, 2023 at 4:32 PM #43826frédéric Gaulbaire
ParticipantHello,
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. -
AuthorPosts
- You must be logged in to reply to this topic.