# How To Change The Slug of A Custom Post Type in WordPress

> Learn how to change post type slugs in WordPress and improve your website's URL structure with our easy-to-follow guide. Avoid confusion and enhance your…

- URL: https://graffino.com/til/how-to-change-the-slug-of-a-custom-post-type-in-wordpress
- Author: Nick Ciolpan
- Channel: wordpress
- Published: 2023-03-01
- Updated: 2026-04-04

To change the slug for a post type in WordPress, you can use the register_post_type() function. Within the arguments array for the function, you can set the rewrite parameter to an array with the new slug you want to use.

Here's an example code snippet:

```php
function change_post_type_slug() {
    $args = array(
        'rewrite' => array( 'slug' => 'new-slug' ),
        // other post type arguments
    );
    register_post_type( 'your_post_type', $args );
}
add_action( 'init', 'change_post_type_slug' );
```

In this example, replace your_post_type with the name of the post type you want to change, and replace new-slug with the new slug you want to use.

Once you've added this code to your functions.php file, you'll need to go to Settings > Permalinks in the WordPress admin dashboard and click the "Save Changes" button to update your permalinks. This will ensure that your new slug is properly applied.
