2
votes

I created a custom post type in Wordpress and I would like to add support for thumbnails. I have created the post type specifying support for thumbnails, but in the editing window of the post type page does not appear the option to specify a thumnail.

I'm using Gutenberg as an editor, with the classic editor, there's no problem. Any solution?

Thanks!

5

5 Answers

3
votes

First add theme_support within functions.php

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

Then add 'editor' and 'thumbnail' to supports and make sure you have show_in_rest set to true.

  'supports' => array( 'editor', 'thumbnail'),
  'show_in_rest' => true,

Otherwise it won't work in Gutenberg. Here is the documentation for supports:

https://codex.wordpress.org/Function_Reference/post_type_supports

0
votes

You nee to enable support for Post Thumbnails. https://codex.wordpress.org/Post_Thumbnails

The common way is to add

add_theme_support( 'post-thumbnails' );

in your functions.php

0
votes

There's a bug report regarding this issue. Kindly refer to the link Feature Image disappears only in Gutenberg with CPT.

0
votes

As most of common solutions around the web doesn't work I will put only that sometimes themes or plugins use

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

So it's worth to check this and add the cpt name to array.

0
votes

Add this on your functions.php:

add_theme_support( 'post-thumbnails' );