Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

For some reason I am not able to upload images OR set the Featured Image on a custom post type in my custom wordpress theme.

I have added theme support of post-thumbnails to my functions.php file and my custom post type supports it. The link to add the featured image works and it allows me to start uploading the file. But before the file can complete it gives me the error message "An error occurred in the upload. Please try again later". If I visit the media library directly, the file is there, but it shows an error in the custom post page.

Also, when I open the media library from the custom post page it shows as empty.

Anyone out there have any thoughts on why this is?

share|improve this question
    
Check the permissions on your uploads folder. Are you able to upload media in general? Can you attach featured images to your posts (ie, the WordPress post type)? –  Pat J Jun 17 '13 at 2:10
    
I have checked that already. If I go to Media > Add New Media I can upload files just fine. –  Reaction21 Jun 17 '13 at 2:18
    
Deactivate all plugins. Does the problematic behaviour remain? If not, reactivate your plugins one by one and try again after each one. –  Pat J Jun 17 '13 at 2:23
    
I do not have any plugins activated. Also this is a 100% custom theme that I have created. Any other ideas? –  Reaction21 Jun 17 '13 at 2:28
1  
check your browser's error console for javascript errors. are you enqueueing any javascript files in your theme? –  Milo Jun 17 '13 at 2:30

2 Answers 2

up vote 0 down vote accepted

I found the answer. I was using a function to set the thumbnail sizes incorrectly. After I changed that function to the correct format it suddenly started working again.

share|improve this answer

Make sure to define( 'WP_DEBUG', FALSE ); in wp-config.php. For some reason it doesn't allow you to add featured images from a custom post type with Debugging on.

share|improve this answer
2  
If that is true, then something else must be wrong with your code. –  ialocin Jul 7 at 20:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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