How to change the WordPress URL Structure

The base WordPress URL structure is customisable from Settings → Permalinks. In which you can change the global permalink settings for pages, posts categories and tags.

What is a permalink?

A permalink is the full URL address for any page, post or other pieces of content on your website. As its name suggests, a permalink is supposed to remain unchanged for long periods—a permanent link.

What is a Permalink Example

Permalinks are often a simple and memorable URL known as a clean URL and usually consists of a domain name (www.thedigitalduck.co.uk), and a slug (the piece of the URL that comes after the domain name).

Why are permalinks important?

Your permalinks are a vital aspect of your website because visitors will use them to visit and navigate through the pages, while search engines use permalinks to index and rank the content on your site.

Short and memorable URLs are much better than long, non-sensical ones.

By default, WordPress uses “ugly” permalinks, which though short, they don’t reflect the content on the page and as such isn’t good practice for SEO.

https://thedigitalduck.co.uk/?p=N

Where N is the ID of the page/article.

Instead, you should change your permalink structure to an SEO-friendly alternative such as:

https://thedigitalduck.co.uk/post-name

How to change your base permalink structure

WordPress makes it easy to change the base permalink structure for post and pages.

  1. Login to your WordPress Admin Dashboard.
  2. Hover over “Settings” in the main menu (black bar on the left).
  3. Click “Permalinks”.

Select the option you’d like to use and click “Save Changes” located at the bottom of the screen.

WordPress permalink options

The first group of settings that you’ll see on the permalinks screen is labelled as “Common Settings” and will allow you to change the base URL structure across the site.

It offers a few options to choose from including.

Plain

Plain is often the default setting for a WordPress install, and we wouldn’t recommend using it.

https://thedigitalduck.co.uk/?p=N

Day and name

The “Day and name” option will append the publishing date of the article and end with the post slug. This option will only show for posts.

https://thedigitalduck.co.uk/2020/10/01/post-name/

Month and name

“Month and name” will display the year, month and title of the article. This option will only show for posts.

https://thedigitalduck.co.uk/2020/10/post-name/

Numeric

“Numeric” displays the permalink with a prefix of archives followed by the post id. This option will only show for posts.

https://thedigitalduck.co.uk/archives/123/

Post name

The “post name” option is your domain name followed by the slug of the article. It’s the easiest to remember and works well for SEO.

https://thedigitalduck.co.uk/post-name/

We recommend using the post name permalink structure.

Custom Structure

You can also create your own URL structure using the available tags consisting of:

%year%
%monthnum%
%day%
%hour%
%minute%
%second%
%post_id%
%postname%
%category%
%author%

Optional Settings

You can also change the base for tags and categories from the permalinks settings screen. This option will prefix URLs for categories and tags with whatever you put into the box.

For example, if you have a category called “SEO” and set the base as “foo”, then the URL for the SEO category will look like:

https://thedigitalduck.co.uk/foo/seo/

If you’re using WooCommerce, you’ll also see additional options to set product and product category permalinks.

How to change individual post and page URLs

WordPress will use the permalink structure as a template for all the links on your website. However, you can change the URL slugs of the individual posts, pages or custom post types on your site to better optimise for SEO and visitor click-through rates.

To change a page slug, first, navigate to the editing screen of the post or page you’d like to modify.

If you’re using the default WordPress editor, you’ll see a Permalink accordion in the right-hand sidebar.

Click the Permalink accordion item to reveal “URL Slug” setting, change the text displayed in the box and then click the blue “Update” button.

How to Change page URL with WordPress Editor

 

If you’re using the classic WordPress editor, click the “Edit” button located directly below the title field, change the text displayed in the box and then click the blue “Update” button.

How to Change page URL with Classic WordPress Editor

How to change individual categories, tags and custom taxonomy URLs

You can change the URLs of individual categories, tags or custom taxonomies navigating to the editing screens of the “term” you’d like to change and editing the value in the “Slug” field, followed by clicking “Update”.

Avoid 404 errors when changing permalink structures

When changing permalinks structures and page URLs, you’ll need to remember that any links that go to the modified pages will no longer work. That means any links on:

  • Social media
  • Search Engines
  • News outlets
  • Marketing materials (leaflets, posters, business cards)

To fix the issue you can set up 301 redirects, which will then redirect visitors from the old URL to the new one.

Luckily, there are a lot of plugins in the WordPress directory that will automatically create redirects when the permalink structure is changed.

We recommend installing “Redirection” or if you haven’t already got it installed RankMath SEO.

How to change custom post types, base permalink structure

Many plugins will create custom post types, things like events, services, sessions and so on.

If you’d like to change the permalink structure of custom post types, you can filter the rewrite slug by adding this code snippet to your themes function.php file.

add_filter('register_post_type_args', 'events_to_meetups', 10, 2);

function events_to_meetups($args, $post_type){
	if ($post_type == 'events'){
		$args['rewrite']['slug'] = 'meetups';
	}
	return $args;
}

The above code will change the permalink structure of a custom post type with the slug events. Resulting in the URL going from:

https://thedigitalduck.co.uk/events/january-meetup

to

https://thedigitalduck.co.uk/meetups/january-meetup

How to change custom taxonomies, base permalink structure

To change the permalink structure of custom taxonomies, you can filter the rewrite slug by adding this code snippet to your themes function.php file.

add_filter('register_taxonomy_args', 'locations_to_places', 10, 2);

function events_to_meetups($args, $taxonomy){
	if ($taxonomy == 'location'){
		$args['rewrite']['slug'] = 'place';
	}
	return $args;
}

The above code will change the permalink structure of a custom taxonomy with the slug location. Resulting in the URL going from:

https://thedigitalduck.co.uk/location/dorset

to

https://thedigitalduck.co.uk/place/dorset

Custom permalink recipes

The WordPress permalink structure is very customisable, especially with a little coding know-how. Here are a few advanced permalink structures that are popular.

How to show the post category in the permalink

Adding a post category to your permalink can be accomplished through the permalink settings screen by:

  1. Login to your WordPress Admin Dashboard.
  2. Hover over “Settings” in the main menu (black bar on the left).
  3. Click “Permalinks”.
  4. Select “Custom Structure”
  5. Enter /%category%/%postname%/
  6. Click the “Save Changes” button.

How to add post categories to URLs WordPress

Now your blog posts will display the categories in the URL, resulting in something like this:

https://thedigitalduck.co.uk/wordpress/what-is-wordpress-the-beginners-guide/

If a post has multiple categories, then each term will be in the URL as sub-directories like so:

https://thedigitalduck.co.uk/wordpress/web-basics/what-is-wordpress-the-beginners-guide/

How to show the WooCommerce product category in the product permalink

WooCommerce makes it easy to add product categories to the product URL. If-fact you can do it directly from the WordPress permalink settings screen.

  1. Login to your WordPress Admin Dashboard.
  2. Hover over “Settings” in the main menu (black bar on the left).
  3. Click “Permalinks”.
  4. Scroll down to the “Product Permalinks” section.
  5. Select “Shop base with category”. (This will prefill the Custom base field).
  6. Click the “Save Changes” button.

How to add prduct categories to URLs WooCommerce

How to change the WordPress URL Structure

WordPress provides a lot of easy to implement settings for many common URL structures from within the permalink settings screen. Any permalink structures that aren’t found in the settings can be achieved with PHP code through the various hooks and filters.

Become an affiliate

Promote our premium plugins and earn yourself an awesome 30% commission.

Become an affiliate

Our plugins

Looking to add a little more to your WordPress website? Our plugins are a great place to start.

View plugins