I created a custom post type called products without support for thumbnails because I want to add the support for post-thumbnails in functions.php file. So I use after_setup_theme action hook and use this code:

add_theme_support( 'post-thumbnails', array( 'products ) );

as explained at this link: http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails

But I can't find the Featured image box when i create/update product type posts.

I looked up in add_theme_support function in theme.php file but I can' fine any reference to post-thumbnails.

Which is the best way to add support and why I can't find any reference to post-thumbnails in add_theme_support function?

1 Answer 1


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.

  • I think the code example in codex is wrong. i better studied the add_theme_support function and it doesn't require args. Oct 18, 2014 at 16:39
  • Perhaps the understanding to the code was error-prone. Yes, it doesn't require arguments, but it can take arguments. You probably missed Line#1769. Oct 18, 2014 at 16:55
  • But this happens in current_theme_supports function Oct 18, 2014 at 17:07
  • And finally it's filtering $_wp_theme_features[$feature] with itself using add_filter() (Line#1810). Oct 18, 2014 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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