• Resolved mapples

    (@mapples)


    Hi, How can I get the following in the permalinks:

    .com/base/archive/post

    ex:

    .com/products/featured/this-widget-thing

    • This topic was modified 2 years, 5 months ago by mapples.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Definitely going to need to explore rewrite rule customization which CPTUI doesn’t have full offerings for.

    I guess my question, with your example, is which parts are from what? Like is “product” your post type or is “featured” ? I assume “this-widget-thing” is the post itself.

    Is featured perhaps a taxonomy term?

    Also mostly curiosity, is this an attempt to recreate previous permalinks from say a different site version and things are getting updated/moved and needing to retain for SEO or similar purposes?

    Thread Starter mapples

    (@mapples)

    Yup I’m researching those, but it’s over my head so it will take some time to digest.

    Yes it’s from a woocomm website. They had a WOO permalink fixer plugin which corrected the URLs, but it seems more difficult to do it with CPTs.

    I attempted to do it as follows:

    .com/base/archive/post
    .com/products/featured/this-widget-thing
    .com/custom-post-type/term/post

    I tried to set ‘Custom Rewrite Slugs’ as well as various combinations of ‘Rewrite With Front,’ (mostly with the / hack, which I know you don’t like) in combination with a plugin that rewrote the post URL to /%taxonomy%/%postname%/

    So instead of .com/custom-post-type/postname as the out of the box default, it would be .com/custom-post-type/term/postname (term, not taxonomy)

    As well as, instead of .com/taxonomy/term it would be .com/custom-post-type/term

    Long story short, the goal is to have:

    .com/custom-post-type/
    .com/custom-post-type/term/
    .com/custom-post-type/term/post

    …where, all of those URLs have content. Or as a macro view of what I’m trying to accomplish, because it doesn’t necessarily have to use those specific types/tax combinations…

    …ideally, WordPress would recognize them as (I hope I’m making sense on this one):

    .com/archive/
    .com/archive/archive/
    .com/archive/archive/post

    (The first archive .com/archive/archive/post will always have the same slug and will never change.)

    For now I’m using a hierarchical setup on the custom post type to accomplish what I’m describing. Which of course has it’s drawbacks. But it currently looks like this:

    .com/custom-post-type/parent/child
    aka…
    .com/archive/post/post

    • This reply was modified 2 years, 5 months ago by mapples.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Yeah, definitely an interesting situation overall.

    Admittedly not sure how to best go about that, as I’m not super knowledgeable around customizing permalinks like that. I do know that each part is important in telling WordPress what to query for, whether it be a post in a post type, a page, a specific archive for a taxonomy term, etc.

    I also know that inserting terms into permalinks can be potentially interesting because posts can have multiple terms associated with it, so which one should be used, or should all of them technically work and point to the same content? However at that point you also risk issues around duplicate content on the site, which is an SEO issue.

    CPTUI is great for setting the rewrite slug for the post types/taxonomies, but that’s only one portion of a given permalink, not customization of the permalink as a whole.

    Thread Starter mapples

    (@mapples)

    I was wondering if it was possible to remove the post type from the URL and only use the tax/term.

    So instead of (as I was thinking)…
    /post-type/term/post
    it could be…
    /tax/term/post

    Which would accomplish what I was looking for.

    Still gives 404s on the post level but it seems like the easier way to go about it, possibly with some custom code. Which I’m still looking into.

    Yoast handles dupe content well, with setting primary term and canonical options, so that’s not an issue for this particular case.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    The thing with /tax/term/post is that WordPress is very likely going to think the /post portion is a child term being requested an archive for, instead of a single post in a post type. That’s part of where it’s getting pretty hairy and tricky to achieve these structures.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘url structure’ is closed to new replies.