Support » Fixing WordPress » How to rename Custom Field Templates / Custom Post Types

  • Resolved edwinbradford


    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…

Viewing 1 replies (of 1 total)
  • 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.

Viewing 1 replies (of 1 total)
  • The topic ‘How to rename Custom Field Templates / Custom Post Types’ is closed to new replies.