How to add Topic slug to Article URL

You are here:
Estimated reading time: 1 min

Sometimes it can be useful to include the Topic URL part before the Article slug. By default, KB Article URLs look like this:

https://www.your-site.com/kb-base/your-article-url

With the topic it would look like this:

https://www.your-site.com/kb-base/article-topic-url/your-article-url

You can edit the KB base in plugin settings and you can edit the KB Article slug in article edit screen, but unfortunately, WordPress does not allow to add the taxonomy (Topics) prefix for custom post types items (Articles).

The solution

Fortunately, this problem can be solved using the Custom Post Type Permalinks plugin.

The plugin page on WordPress.org

When you install and activate this plugin, you’ll be able to add the Topic prefix for KB Articles (and any other custom post types you use) in SettingsPermalinks:

Custom Post Type permalinks settings

Actually, you don’t have to configure anything – the plugin adds the Topic prefix by default (maybe you’ll need to save the permalinks settings to flush the rewrite rules cache).

One thing to keep is mind is this: when you change the topics of the article, the URL will be different. It looks like the plugin handles this without issues – you’ll get a redirect instead of 404. But it’s still a good idea to be extra careful with changing topics if you need to keep the old URLs for any reason.

Was this article helpful?
Dislike 0 2 of 2 found this article helpful.
Views: 140
Previous: Multiproduct Knowledge Base Setup
Have questions? Search our knowledgebase.
Send this to a friend