Custom Post Permalinks
How to use Identical Custom Post Permalink structure for different (2 posts)

  1. stamari
    Posted 4 years ago #

    Hello, I am using the Custom Post Permalink plugin as well.

    I have several custom post types (named Articles, Reviews, News)

    I want the URL's for the post type to be based off of their titles and their WordPress categories: /%category%/%Reviews%/

    If I try to use this structure on more than one custom post type, then I get 404's when I go to the website.

    I have only gotten the site to work with this structure (entered in the Custom Post Permalinks Plugin):


    However, I have a requirement to have the url's without the /%post_type%/.

    I've read up on this a bit and I know that it is less than ideal to begin your permalinks with /%category%/ but this is my requirement.

    Can you help please?

    I am not sure if it's relevant, but my post types are defined like so:

    [code removed - please use pastebin.com]
  2. John P. Bloch
    Plugin Author

    Posted 4 years ago #

    You're getting the 404 error because every single one of those permalinks in regular expression form, without the post_type anchoring them, will look like /(.*?)/([^/]+)/? Meaning when WordPress tries to find a match, all post types look exactly the same. So if you have registered Reviews, Articles, and News in that order, WordPress will interpret a URL for Posts, pages, News, Articles, and Reviews as Reviews (or News, depending on how the registration was handled). In fact, nothing but the home page will work. You need to differentiate your permalinks. %post_type% does that. If you need that gone, then you shouldn't be using custom post types; you should be using custom taxonomies.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic