How to remove “featured image” functionality from a custom post type?

I have made a custom post type for a child theme. I removed “thumbnail” from the supports array in functions.php and that prevents a featured image meta box from being displayed. However, when in the “add an image” modal dialogue thing, there is still a “Use as featured image” link. Why, oh why? More to the point, does anyone know how to remove?

I tried…

Read More

remove_post_type_support( ‘itinerary’, ‘post-thumbnail’ );

…where itinerary is the name of my custom post type. Any help would be greatly appreciated!

Steve

Related posts

Leave a Reply

3 comments

  1. Some where in your theme you should have:

    add_theme_support( 'post-thumbnails' );
    

    Instead of removing support for a post type try only adding support for the post types you want:

    add_theme_support( 'post-thumbnails', array( 'post', 'movie' ) );
    
  2. To add to Brady’s answer…

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

    If you only want to add support to a single post type, keep the array() in the declaration. With debugging turned on, if you declare add_theme_support( 'post-thumbnails', 'post' ); wordpress will complain that it is expecting an array when on the post edit page. So to enable Featured Images to only posts…

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

  3. A more modern approach is to use remove_post_type_support(post_type, 'thumbnail').

    Option #1: Remove it immediately after creating your custom post type:

    $args = []; //your args here
    
    register_post_type('my_post_type', $args);
    
    remove_post_type_support('my_post_type', 'thumbnail');
    

    Option #2: Remove it from an existing post type:

    function remove_thumbnail_support()
    {
        remove_post_type_support('my_post_type', 'thumbnail');
    }
    
    add_action('init', 'remove_thumbnail_support', 11);