Add theme support for post thumbnails

What add_theme_support( 'post-thumbnails', array( 'products' ) ); did is: it added the support for the post-thumbnail feature, and with the second parameter you fixed the feature support to only post_type = ‘products’. But it actually saying: Ok, load all the necessary things to register a Post Thumbnail — you’re actually introducing ‘Post Thumbnail’ to WordPress.

But to add/show the “Featured Image” meta box you have to activate the “Post Thumbnail” feature when you are registering the Custom Post Type like below:

$args = array(
   'supports' => array( 'title', 'thumbnail' ) //it'll enable the meta box
);
register_post_type( 'products', $args );

But with this bit of code you are actually saying: Ok, you know what [post]’thumbnail’ means, now let the user to add one.

So you will need to add both the theme_support and the post_type support meta box.

Leave a Comment