Rename a current used post type

You are in the right direction. When doing something like this, make sure you look at every possible place where this needs to be changed as you don’t want data inconsistency. Some suggestions to make this process better:

Don’t hardcode WordPress table name ($wpdb->posts) in the query. This won’t work if the install has a custom table prefix set in their wp-config.php

Save the version no of ur plugin and write upgrade functions which works on the basis of versions and then you can call them individually or in a batch checking how many upgrade functions needs to be run. Everytime you change something like this make a function that you will call if a client is upgrading from X version and then you can chain upgrade functions in a batch if the client hasn’t updated from a long time.

Leave a Comment