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,
Also, find the code in this same file,
Replace it with the following code,
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,
Replace it with this code,
• 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,
And change the name of taxonomy to all lower case,
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,
Replace it with this code,
// 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.
Sometimes I encounter this Fix Cheatin thing, sometimes I don’t. But I’m still using the same theme. I wonder why.
Sorry, I can’t find “medialibrary-uploader.php” where is it? My theme is InStyle by Elegant Themes.
Clear your browser’s cache to fix this issue.
If you are using a theme from Elegant Themes, just update the theme to latest version to fix the issue.