• Resolved Todd Edelman

    (@toddedelman)


    Hi there

    I’ve created a taxonomy called year and want to use Custom Rewrite Slug, but I cannot figure out how to get it to do what I want.

    I’ve put this in the field: memorial-room/victims-murdered-in-
    Which currently creates an archive page such as: memorial-room/victims-murdered-in-/2019/
    But what I’m looking to achieve is this: memorial-room/victims-murdered-in-2019/ < (2019 is the taxonomy)

    Can this be done? And if yes, how?

    Thanks,
    Todd

Viewing 1 replies (of 1 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I can’t guarantee that it can be done, but if it can, it’s outside of what CPTUI covers.

    The thing with rewrites and permalinks is that each segment between /’s is part of what determines what to show. Each is a query parameter

    I realize it may not be pages, but just for the sake of quick example, imagine the first part of that url example are pages.

    the “memorial-room” part would probably get interpreted as the parent page, “victiums-murdered-in” would be the first child page, and then “2019” would be the grand child. Each part would be the page name/slug that gets used to locate the overall page content to show.

    As a custom post type, “memorial-room” would end up being the post type slug, and “victims-murdered-in” would be the post slug for one of the post type posts.

    What you’re trying to do is have variable query parameters which the rewrite api parsing my not understand.

    What may be more feasible, is have pages/post type posts that have a slug of “victims-murdered-in-2019” and whatnot, and then use either custom templates or shortcodes or whathaveyou that do custom queries based on what’s in the URL. You may even be able to grab the last part of the “victims-murdered-in-####” portion in a custom callback for the pre_get_posts hook and modify the query then.

    Hopefully I haven’t overwhelmed you with too much information, but it’s sadly not as simple as one could ideally prefer.

Viewing 1 replies (of 1 total)

The topic ‘Custom Rewrite Slug Configuration’ is closed to new replies.