• Hello,
    I have a custom post type called ‘articles’, and it includes many custom fields necessary to how things get posted. When an article is created, it takes the URL:

    domain.com/article/article-name

    I have a single article that I would like to make a shortened URL for it, so that it can be accessed like this:

    domain.com/article-name

    I know I could change the slug for the entire custom post type, but that would cause many more issues and it’s not the route I want to go. I know I could do a single 301 redirect from my desired URL to the real URL, but I prefer that the desired URL is what shows in the address bar.

    Any thoughts or recommendations, I’ve searched and not found anything dealing with a single custom post out of an entire custom post group.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    .htaccess RewriteRules that are relative (no http or domain involved) will not alter the address bar. All pretty permalinks are rewritten to go to WP through index.php, yet the permalink remains in the address bar.

    If that’s unsatisfactory, add_rewrite_rule() can be used to the same effect.

    If all else fails, use the “redirect_canonical” filter to set the address that’s displayed.

Viewing 1 replies (of 1 total)
  • The topic ‘Create shortened URL for a single post in a custom post type’ is closed to new replies.