Hierarchical Post Type causes 404

Support MB Custom Post Type Hierarchical Post Type causes 404

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #43668
    Roel PetraRoel Petra
    Participant

    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:

    • 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!
    - Roel

    #43675
    PeterPeter
    Moderator

    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.

    #43677
    Roel PetraRoel Petra
    Participant

    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

    #43684
    SridharSridhar
    Participant

    Hi Roel,

    Do you mind sharing the URL of any post of your CPT type where the problem can be seen?

    #43685
    SridharSridhar
    Participant

    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

    #43686
    Roel PetraRoel Petra
    Participant

    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.

    #43687
    SridharSridhar
    Participant

    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?

    #43688
    Roel PetraRoel Petra
    Participant

    You want a screencast of me showing when it stops working?

    #43689
    SridharSridhar
    Participant

    yes and also your Bricks template setup/structure and template condition.

    #43690
    PeterPeter
    Moderator

    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.

    #43693
    Roel PetraRoel Petra
    Participant

    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

    #43696
    SridharSridhar
    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.

    #43697
    Roel PetraRoel Petra
    Participant

    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!

    #43708
    Roel PetraRoel Petra
    Participant

    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.

    #43826

    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.

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.