9

I found an annoying typo in the machine name of one of the content types, and I'd like to fix it. The only way I know is to delete the content type, and create a fresh one, but there is a plenty of fields in that content type that I don't want to recreate.

Is there a better way?

15

Go to structure, click content types, click edit next to the content type you want to edit. Click edit next to the machine name and change it to the name you want.

screenshot

screenshot

If you merely want to change the administrative name, then change that instead.

  • Oh, didn't think it's so easy :) – Dmitry Vyal Aug 18 '11 at 10:37
  • Careful, it's not always so easy. I've had data loss doing this, most modules don't play nice if they've stored configs using the machine name. I'd only do this if I had a backup, just in case. – Renee Jun 2 '13 at 2:41
  • 1
    Ensure to flush your cache after making the change. – Nigel Waters Aug 28 '13 at 3:18
  • 7
    I don't see a link to edit machine name in the latest D7. Has it gone (or does it require a module)? – Valery Lourie Jun 12 '14 at 13:30
  • Can't see either (on different admin themes) – Rootical V. Oct 12 '16 at 13:35
0

If the name is unique (it probably is if it contains a typo), change all occurrences of the name in the database (including table names) and clear the cache.

In D6 the table node_type contains content type machine name definitions. Those names are also used in tables with the prefix content_type_. If the content types aren't used anywhere else, changing the entry and the table name should do it. It's possible that those names have changed in D7.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.