Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Feature images not working in wordpress

Hey,

I have added support "add_theme_support( 'post_thumbnails');" for thumbnails into my functions.php file. For some reason when I want go and enter data in my custom post type, the feature image input doesn't appear.

Can someone please help. I have searched the Interwebs and can't find an answer.

7 Answers

Maybe you can try this:

add_theme_support( 'post-thumbnails', array( 'your-custom-posttype-name' ) );

You are a life saver! Thanks Stanley! It works. So do I do this for every custom post type I presume ?

It depends.

Do you code the custom post types yourself or are u using a plugin?

But indeed you can just add the other posttypes u like to have the support

add_theme_support( 'post-thumbnails', array( 'your-custom-posttype-name', 'another', 'another2' ) );

At the moment plugins (CPT UI and Advance custom fields)

But thanks hey, you helped a lot!

Alright,

I think if you just use add_theme_support( 'post-thumbnails' );

and you check the option 'Featured Image' at the bottom of the setting page 'Support section' of your custom post type, it should work too:)

I tried it. It didn't work for some reason.

make sure you change your function back to:

add_theme_support( 'post-thumbnails' );

and make sure you have selected the featured image at the support section of your custom post type settings page and it should work fine.

It works now for some reason. Thanks