41

I have thumbnail support added with the following in my functions.php

// Add Thumbnail Support
add_theme_support('post-thumbnails');
set_post_thumbnail_size( 140, 140, true );

And I create the custom post type with

// Create Custom Post Type for Work
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'custom_post',
    array(
        'thumbnail',
        'labels' => array(
            'name' => __( 'Custom' ),
            'singular_name' => __( 'Custom' )
        ),
        'public' => true,
        'has_archive' => true,
        'rewrite' => array('slug' => 'custom'),
        'taxonomies' => array('category', 'post_tag')
    )
  );
}

However, when I create a new post in the Custom Post Type, the Featured Image meta box does not show. I have also tried using an array when declaring the custom post type, as follows but that didn't work either

// Add Thumbnail Support
add_theme_support('post-thumbnails', array ('post','work','custom_post'));
set_post_thumbnail_size( 140, 140, true );

What am I missing?

3 Answers 3

67

try the register_post_type supports parameter:

'supports' => array( 'thumbnail' )
3
  • Ahhh of course. Either I was staring at it for too long, or I just haven't had enough coffee yet. Thanks Milo!
    – Ryan
    May 11, 2012 at 16:12
  • 9
    This also remove support of title and editor content, which are enabled by default. I had to use 'supports' => array('title', 'editor', 'thumbnail'),.
    – amoebe
    May 18, 2017 at 14:43
  • 3
    Also, remember to actually allow post-thumbnails for your theme like this: add_theme_support( 'post-thumbnails' );
    – skolind
    Mar 8, 2018 at 14:47
8

Add this parameter into your array:

'supports' => array('thumbnail'),

Edit: Milo was faster.

1
  • I think this suits my needs better than milo's :D Jun 27, 2017 at 15:16
6

Try this it works for me.....

add_theme_support('post-thumbnails');
add_post_type_support( 'my_product', 'thumbnail' );    
function create_post_type() {
        register_post_type( 'my_product',
            array(
                'labels' => array(
                    'name' => __( 'Products' ),
                    'singular_name' => __( 'Product' )
                ),
                'public' => true,
                'has_archive' => true
            )
        );
    }
    add_action( 'init', 'create_post_type' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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