• Resolved Gregosz

    (@gregosz)


    Could you explain to me why we have two fields to overwrite the Post Type Slug field? We can do it using the Custom Rewrite Slug field and the field below Has Archive field. Is there any difference in using them?
    When should I use the first one and when the second one?
    regards,
    Grzegorz

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

    (@tw2113)

    The BenchPresser

    Why there are two fields like that, you’d have to ask WordPress core developers for that one. I just do what I can to match the register_post_type arguments as best possible.

    I would say if you’re going for consistency in your permalinks, use the “custom rewrite slug” field. That’s going to affect the most URLs. The “archive slug” is only going to be used for that base archive URL.

    To add some clarity to that, I have a post type slug of movie, I made an archive slug of “film” and a rewrite slug of “show”. Archive was seen at .com/film/ and when I clicked to a single post, it was com/show/armageddon/ etc.

    When I took off the archive slug, both were .com/show/

    At least at the moment, I can’t think of any need, at least one that I’d have, to use the archive slug only, and not the custom rewrite slug. However, I’m sure others have and still do for their own purposes. My vote is go for the consistency via custom rewrite slug.

    Thread Starter Gregosz

    (@gregosz)

    Thanks a lot for giving me some light on this!!!

    Now everything started to fall into place for me:

    The Post Type Slug field is used in the database. Therefore, there is a need for its value to be unique. (I mean, it should not be the same as the names of other objects in the database.) But as a result, it will not always be human and SEO friendly.

    This is why we need a field that would overwrite this field.

    And the fact that we have two such fields is also an advantage. Thanks to this, we can have a different slug for the archive and a different one for individual postws. I think there are times when it is useful for SEO.

    And one last thing. I did a similar experiment as you did. When a value is removed from the Custom Rewrite Slug field, the slug for the individual posts is taken from the Post Type Slug field.

    Best wishes!
    Grzegorz

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Glad I could help clarify details ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How should I overwrite the Post Type Slug field? What is the proper way?’ is closed to new replies.