WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to rename Custom Field Templates / Custom Post Types (2 posts)

  1. edwinbradford
    Member
    Posted 3 years ago #

    I'm posting this as an FAQ for myself and anyone else that wants to rename a Custom Field Template otherwise known as a Custom Post Type. I believe there's a plugin that may do this but I prefer to be independent of plugins where possible.

    Within MyPHPAdmin, the names are not stored in the MySQL wp_postmeta table where most references took me, that's where Custom Field Names are stored, instead you have to look in the MySQL wp_posts table. If you go to the table and scroll way to the right you will find a column marked post_type this is your Custom Field Template name (Custom Post Type name if you prefer).

    You can either rename entries manually or do it more thoroughly by choosing the MySQL tab where you can enter the following:

    UPDATE wp_posts SET post_type
    = REPLACE (post_type,
    'oldName', 'newName')

    Note that post_type must be inside a backtick and not an apostrophe. oldName and newName are the old and new names of your Custom Post Type Name (Custom Field Template Name).

    I've tried to enclose that code so it will reproduce without the forum breaking it because of the required backticks...

  2. edwinbradford
    Member
    Posted 3 years ago #

    And of course it didn't work, sigh, why do I bother.

    UPDATE wp_posts SET "post_type"
    = REPLACE ("post_type",
     'oldName', 'newName');

    As the forum engine is too dumb to escape backticks despite my putting a code tag around the lot I've replaced them with double quotes, just replace them.

Topic Closed

This topic has been closed to new replies.

About this Topic