WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type UI
[resolved] Hierarchical links not working (2 posts)

  1. rivkadr
    Member
    Posted 5 months ago #

    I have a custom post type called "events". When I create an event that has a child, the child URL always 404's. Example URL:

    http://www.mysite.com/events/eventname/child-event/

    Query Vars is set to true; I've reset my permalinks more times than I can count. Have looked at Rewrite Rules Inspector, and the top rule that comes up when testing a link like the above is as follows:

    events/(.+?)(/[0-9]+)?/?$ index.php?events=$matches[1]&page=$matches[2] events

    I'm outputting the query data, and am getting the following:

    [query] => Array
    (
    [page] =>
    [events] => eventname/child-event
    [post_type] => events
    [name] => eventname/child-event
    )

    [queried_object] =>
    [queried_object_id] => 0
    [request] => SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND (wp_posts.ID = '0') AND wp_posts.post_type = 'events' ORDER BY wp_posts.post_date DESC

    It's like the query is just flat out ignoring the query vars. I've looked in the DB, and the post_name is listed as "child-event", so it seems like if it was searching under the name, it wouldn't find it anyway...

    Any help is appreciated.

    http://wordpress.org/plugins/custom-post-type-ui/

  2. Michael Beckwith
    Member
    Plugin Author

    Posted 5 months ago #

    Hopefully you found a breakthrough since posting this, but I'll see what I can think up for possible help.

    I'm not great with regex by any means, but I wonder if that regex is looking for numerals only with the child post portion. Just a thought.

    However, the queried_object_id and request SQL makes it look like it's looking for any posts that have the post ID of 0, which won't ever happen.

    Is this the only plugin you have enabled or do you have others? If you do, are you at a point where you could disable the other plugins long enough to test this again? I know sometimes other plugins can be conflicting and whatnot. Even further would be changing to one of the twenty* themes temporarily, but I'm more worried about other plugins.

Reply

You must log in to post.

About this Plugin

About this Topic