---
title: "Add custom permalinks to the WordPress Post URLs"
url: https://coolplugins.net/add-custom-permalinks-to-the-wordpress-post-urls/
date: 2021-08-09
modified: 2026-05-29
author: "Satinder Singh"
description: "WordPress permalinks control how URLs are structured, and default posts use formats like site.com/hello-world. You can customize URLs via Settings → Permalinks using structures like /blog/%postname%/ for cleaner SEO-friendly links. Custom post types may inherit unwanted base slugs, which can be fixed using register_post_type rewrite settings. Adding ‘with_front’ => false prevents global permalink prefixes from affecting custom post types and taxonomies."
categories:
  - "WordPress Tips"
image: https://coolplugins.net/wp-content/uploads/2025/04/custom-permalinks-wordpress-posts-fimg-800x450.png
word_count: 334
---

# Add custom permalinks to the WordPress Post URLs

![custom permalinks](https://coolplugins.net/wp-content/uploads/2021/09/custom-permalinks.jpg)

If you are using [WordPress ](https://wordpress.org/)to create websites and projects you may notice the URL of the website looks something like ***Site_URL/hello-world***, for the default page. Let's now see how to Add custom permalinks.

If you want to set the permalink settings to postname, and after adding “blog” to the post URL, your site URL will look like this ***Site_URL/blog/hello-world***.

### Now let's see how to do this on our Wordpress Website :

- Navigate to your WordPress **Dashboard >> Settings >>Permalinks. **

- Choose custom structure from the options and enter *“/any_name/%postname%/.*

- Now click on save the changes button, because if you will not save the changes then this change will not be affected on your website.

- Now check your post URL and it should contain the new name.

It's not done yet because when you do this, it will also affect the post type and all the post (custom and default) in you website will look like :

***SITE_URL/blog/post1***

***SITE_URL/blog/post2***

If it will work for you no problem but if you don't want a blog in your custom post type you have to add one more parameter.

While creating post type, we use ***register_post_type()*** method, both these functions have the rewrite key, add ‘with_front’ => false’ to this parameter to keep your URL unaffected.

Your code will look something like this : 

PHP// custom post type 'product'

register_post_type( 'product',

    array(

        ...

        ...

        'rewrite' => array('slug' => 'product', 'with_front' => false),

    )

);

// custom taxonomy 'product_cat'

register_taxonomy(

    'product_cat',

    'product',

    array(

        ...

        ...

        'rewrite' => array('slug' => 'product_cat', 'with_front' => false),

    )

);
```
// custom post type 'product'

register_post_type( 'product',

    array(

        ...

        ...

        'rewrite' => array('slug' => 'product', 'with_front' => false),

    )

);

// custom taxonomy 'product_cat'

register_taxonomy(

    'product_cat',

    'product',

    array(

        ...

        ...

        'rewrite' => array('slug' => 'product_cat', 'with_front' => false),

    )

);
```

After adding ‘with-front’ => false, to both register_post_type() and register_taxonomy(), update the permalinks on the permalinks settings. By this now you will see ‘/bog” on only the default and category posts but on the custom posts.