Cheatin’ uh? Error – WordPress Custom Post Types

This is for those of you hunting for the Cheatin’ uh? WordPress error when developing custom post types.

It’s most likely an issue with what you named a custom taxonomy that you intend to attach to a custom post type.

In our case we had…

register_taxonomy("Types", array("portfolio"), array("hierarchical" => true, "label" =>; "Types", "singular_label" => "Type", "rewrite" =&> true));

This is a frustrating error because you simply get the “Cheatin uh?” message.

Here’s the fix

register_taxonomy("types", array("portfolio"), array("hierarchical" => true, "label" => "Types", "singular_label" => "Type", "rewrite" => true));

Notice the difference? The fix is your custom taxonomy’s name has to be lower case. That should save you a couple hour hunt down a rabbit hole.

24 Comments

  1. Hi… I already have my custom taxonomy name, all in lowercase. I had set the custom posts capability type previously to posts, but then I needed to add meta capabilities hence I changed the capability_type to 'company' (thats my custom post) and mapped all the required capabilities. But now when I click on the Companies link in my dashboard, I get 'Cheatin' uh?' error. Any idea? I can post my custom post registration code here if you want.

  2. And if you're using multiple words in your custom taxonomy name, be sure not to have spaces. Use a dash between, or you'll continue to get the error. Multiple words can be useful so you avoid clashes with future possible taxonomies.

    1. Dan – In most cases this code is in the functions.php file, or wherever your theme register's custom post types. If you can send me some more information I may be able to help.

  3. Hi abrudtkuhl,
    so I have same problem. Where should i paste this code? I used WP 3.4.1.
    There is "register_taxonomy" only in taxonomy.php and post.php file, but not in your compilation.
    Is not your code for another WP version?
    Thanks for your help.

    1. No it works with the latest version. Note: You shouldn't be doing anything in taxonomy.php or post.php as those are core WordPress files.

      This solution only applies if you get the error when creating custom post types, which should be located in the functions.php file of your theme.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>