close

Shelley Bassett

Menu

Close

Adding a word in the url


May 21, 2018

Adding a word in the url can help separate different post types. Adding "blog" into the post url is an easy way to identify them. But can you do this in WordPress? It's easy if you know how!

If you have a number of custom post types, it might be useful to have an identifier in the link. Adding a word in the url is an obvious way to do this. But sometimes this isn’t as easy as it seems. Let’s follow the recommended way to do this, then troubleshoot some common issues.

The most common time to add a word into the url is to separate blogs from normal pages and other posts like products. Instead of creating a custom post type for them, you could use the standard posts, but prefix the url with “blog”. The desired result would be something along the lines of your-url.com/blog/post-category/post-sub-category/post-title . It seems simple, but can be a little bit fiddly. This tutorial should help you achieve this.

Adding a word in the url

To change how a url appears in WordPress, you need to edit the permalink settings. These can be found in your admin area, under Settings -> Permalinks. The specific options were looking for are custom structure and category base. These settings should be as follows:

custom permalink structure to add blog in the url

Example url

custom category base to add blog in the url

Example base

You can use any word in place of “blog”. Are your default posts news? Use news. Just remember to be relevant to the users of your site. The category is also not required for this to work, however, this is the structure I have on my blog. It makes navigating the site easy, and helps to group similar posts. The important part here is the category base, which will require a /.  no matter what word you want to use. This makes sure that the rewrite rules know to add category slugs after this word. Forgetting the dot can cause all sorts of strange issues.

And that’s it! Save the settings, and all your permalink urls should include the custom word. Adding a word in the url of a WordPress site is easy! If you’re having difficulties with urls or permalinks, here are some tricks you can try to get the pointing to the right places.

 

Leave a comment

Advertisement

Leave a Message | No comments yet

Leave a Reply

Your email address will not be published. Required fields are marked *