Knowledge Base

How to change a custom post type’s slug

In this small guide we’re going to take a look at a couple of ways to change the slug of any Ignition Framework custom post type.

In this example we will be changing the slug of the Accommodation post type from accommodation to room, this means that the URLs will go from this:

https://yourdomain.com/accommodation/sea-view-suite/

to

https://yourdomain.com/room/sea-view-suite/

Say What

The first way is ideal for single language sites. First you will need to install and activate the Say What plugin. Once the plugin is installed and activated navigate to the Tools > Text Changes and click the Add New button.

Now we need to fill in the required strings.

The original string is the default slug of the post type we want to change. The default slugs of the Ignition Framework custom post types are listed below.

  • Accommodation post type: accommodation
  • Discography post type: discography
  • Event post type: event
  • Podcast post type: podcast
  • Portfolio post type: portfolio
  • Service post type: service
  • Team member post type: team

The text domain is the Ignition Framework’s text domain which is always ignition.

The text context is the context for the string we want to change and for this case it will always be post type slug.

Finally the replacement text is the new slug we want for our post type.

As an example we will be changing the accommodation slug on the Aegean Resort theme to room.

After filling in the required information we press the Add button. Next we navigate to Settings > Permalinks in order for the permalink cache to be flushed and we’re good to go.

Loco Translate

Another plugin that can help us here is Loco Translate which is a string translation plugin and is better suited if we have multilingual sites. Install and activate the plugin and navigate to Loco Translate > Plugins > Ignition Framework.

Click the New language link to proceed.

Select the language for which you want the modification to be made from the drop down (1), set the custom location for the file to be saved in (2) and then click the Start translating button (3).

In the search box (1) search for accommodation, from the results pick the one with the post type slug label (2) and type in its replacement in the translation box (3), finally click the Save button (4). Now all you need to do is navigate to Settings > Permalinks to flush the permalink cache and you are good to go, the post type slug has been changed from accommodation to room.

Use the coupon code WORDPRESS and save 30% OFF! Buy Now