Enable/Disable Featured Image Option in Custom Post Type

When you create a new custom post type or you already have one, sometimes you notice the featured image option or meta box does not exist in your custom post type, which means your custom post type doesn’t support the featured image or post thumbnail.

In that case, you have to enable the featured image option for your custom post type.

In this article, I will show you the way to enable and disable the featured image option for your custom post type.

Enable Featured Image Option in Custom Post Type

To add the featured image option for your custom post type, you have to add thumbnail support with it. There are two ways to do that:

Method 1:

Just add the code given below to your theme’s functions.php file and add your custom post type name to it.

This is a quick easy way to enable the featured image support to custom post type.

However, if you want to enable and keep it with your custom post type code, then you can follow the second method.

Method 2:

  1. Find your custom post type code (where you have registered this custom post type)
  2. Find 'supports' parameter inside the array of your custom post type arguments.
  3. Add 'thumbnail' argument to the 'supports' array of your custom post type arguments. (As it added on line 5 in the code given below).
  4. After adding the code, try to refresh your custom post type and you will see a featured image option there.

Disable Featured Image Option in Custom Post Type

To disable the custom post type featured image option, add the code given below to your theme’s functions.php file, and replace the custom post type name in it.

This will disable the featured image option for the given custom post type.

Owner of diveinwp.com, solely responsible for creating helpful, informative content about WordPress, a fulltime WordPress developer with 8+ years of hands-on experience in WordPress design and development.