Fix Cheatin’ uh? Error in WordPress

If you have upgraded WordPress to the latest version recently, then you may have seen the Cheatin’ uh? error in WordPress while uploading an image.

This error occurs only when a logged in user is trying to do an operation without having sufficient permissions. But in the latest version of WordPress, you will sometimes see this error even if you are logged in as an administrator.

This is certainly a bug in WordPress and will be fixed soon. But until then, here are some tips using which you can fix the Cheatin’ uh? Error in WordPress.

• If you are getting this error while uploading a featured image or a logo in your theme options, then probably your theme is using a customized version of SMOF or Slightly modified options framework.

To fix the Cheatin’ uh? error in this case, open medialibrary-uploader.php file in the theme options folder and add this code at top,

add_action( 'init', 'optionsframework_mlu_init');

Also, find the code in this same file,

'post_type' => 'optionsframework'

Replace it with the following code,

'post_type' => 'options'

That’s it. You will now not see the Cheatin’ uh? error error again.

• Its possible that your theme uses some other theme options framework. If this is the case, you need to find the call to media uploader window and remove the post_id from it to fix the issue. The code will look something like this,

tb_show('', 'media-upload.php?post_id='+jQuery('#post_ID').attr('name')+'&type=image&TB_iframe=1');

Replace it with this code,

tb_show('', 'media-upload.php?post_id=0&type=image&TB_iframe=1');

• If your WordPress theme uses custom post types and custom taxonomies, then you will see Cheatin’ uh? error if the name of custom taxonomy is ‘not’ lower case.

So check your theme files to find code that look like this,

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

And change the name of taxonomy to all lower case,

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

Also note that if the name of the custom taxonomy has multiple words, then it should not contain any spaces, or you will keep seeing the Cheatin’ uh? error. You can use underscore to separate words in the name of taxonomy instead of space.

• If none of the above options work for you, you should contact the developer of the theme for a fix. And until he finds a solution, here’s a quick fix. Login to your WordPress install via FTP and open wp-admin/options.php file. Find this code in it,

if ( !current_user_can('edit_posts') )
wp_die(__('Cheatin’ uh?'))

Replace it with this code,

if ( !current_user_can('edit_posts') )
// wp_die(__('Cheatin’ uh?'))

Note that this is a temporary solution until your theme is patched to fix the Cheatin’ uh? error. So you should roll back this change as soon as your theme is fixed.

Comments

  1. Finch:

    Sometimes I encounter this Fix Cheatin thing, sometimes I don’t. But I’m still using the same theme. I wonder why.

  2. Sasawat:

    Sorry, I can’t find “medialibrary-uploader.php” where is it? My theme is InStyle by Elegant Themes.

  3. Mayur Somani:

    @Finch

    Clear your browser’s cache to fix this issue.

    @Sasawat

    If you are using a theme from Elegant Themes, just update the theme to latest version to fix the issue.

  4. Amy:

    Fixing the javascript where it called the media uploader did the trick. I set the post_id to zero and it worked!

Comment?

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