• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2665

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

How To Rename A Custom Post Type

To change the name of a custom post type, simply replace all instances of the custom post type name with the new name you want to use for your CPT.

Code for creating a custom post type generally includes both a singular and plural name. In this example, the names which need replacing are member and members.

Firstly, lets take a look at the basic PHP code needed to create a custom post type:

And here’s a screen shot showing which names need to be changed.

code to make a custom post type

You can change the names manually or use a code editor like Notepad++ to search, find and replace the name with your new name.

Here’s the 4 instances of the custom post type name which need to be changed:

After you rename your custom post type, go to Settings > Permalinks and re-save your Permalinks.

Here’s an example of the code changed from members to photos.

You may also want to change the menu icon using Dashicons.

Change Existing Custom Post Type Pages

After you’ve changed the name of your CPT, you may also need to change the name of any existing single CPT’s created using the old CPT name:

You can do this using various methods like:

  • An SQL Query in phpMyAdmin
  • Using a plugin
  • Manually using a code editor to open and change a copy of your database SQL file.

Here’s 3 Ways To Change & Convert Different WordPress Post Types

Related Tutorials

  • Use SQL Query In phpMyAdmin To Change Custom Post Types

Custom Post Type

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems