[wp-trac] [WordPress Trac] #54007: Custom Post Type, missing meta boxes in edit screen (featured image, custom taxonomy)

WordPress Trac noreply at wordpress.org
Wed Aug 25 17:09:22 UTC 2021


#54007: Custom Post Type, missing meta boxes in edit screen (featured image, custom
taxonomy)
------------------------------+-----------------------------
 Reporter:  geertvanderheide  |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  General           |    Version:  5.8
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 I've added a CPT using register_post_type() inside a simple plugin. As
 expected, the new post type shows up in the Admin menu with the correct
 labels and icon. For the 'supports' argument I've added: array('title',
 'excerpt', 'editor', 'thumbnail'). I expected to see these features on the
 post edit screen, as in WP 5.7 and before. But instead of the Featured
 Image meta box, I only get an empty div in the Block Editor's sidebar,
 with class "components-panel__body".

 I can go into the Block Editor's preferences and then to "Panels", where
 there are toggles for each panel. The Featured Image toggle does show up
 there. Toggling this block only shows or hides a single border (1px) in
 the sidebar, so it's showing and hiding the empty div, but nothing else.

 I've attached an example image, as well as the code used to register the
 post type.

 Meta boxes like the Excerpt do work as expected for this CPT, and so does
 the 'page-attributes' block if I add that to 'supports' and set the CPT to
 'hierarchical'. The featured image also does work for default post types,
 just not for CPTs.

 The featured image meta box is also missing in the Classic Editor - there
 I can't toggle anything though - it doesn't show up under Screen Options
 with this Editor.

 Related: I also added a custom taxonomy and it doesn't show up as a meta
 box for the post type either. Strangely I can set taxonomy terms from the
 Quick Edit feature on the CPT's admin list and they are shown, and values
 are saved. Yet there's nothing on the post edit screen. No toggle for it
 either.

 There are no PHP errors shown, and no JS errors in the console at all.
 I've triple checked my Block Editor setup and I'm not doing anything
 related to these features at all.

 I've added add_theme_support('post-thumbnails') inside 'after_theme_setup'
 in functions.php - this always used to apply right away to any post type I
 would add. Now it doesn't.

 'show_in_rest' is set to true for the post type.

 **What I've tried:**

 - Using a default theme with no active plugins (other than the one
 registering the CPT + Custom Taxonomy). Problem still occurs.

 - Using Health Check to activate / deactive different things. Nothing
 seems to help. Checked the integrity of the files - nothing wrong there.

 - Triple checked my code used to register the post type and taxonomy. It's
 the same as the documentation. The CPT and the Custom Taxonomy are also
 correctly linked, through the CPT's 'taxonomies' argument and in the
 function call for register_taxonomy().

 - Re-installed WordPress 5.8 entirely. No change.

 Similar reports talked about several possible causes and I've ruled them
 all out, mostly by trying the default TwentyTwentyOne theme:

 1. The spelling of the theme folder could be related if it has a name
 containing only 4 numbers. My theme name does not have that issue, as it
 is simply named "Main".

 2. Some issues with custom capabilities may cause behavior like this, but
 I'm only using default capabilities ('post' or 'page') for the post type.
 I'm using WP as an administrator user.

 3. Issues related to child themes have led to missing meta boxes
 apparently, but I'm not using a child theme, only a main custom theme, or
 a default theme.

 4. Issues relating to the theme header inside style.css have been reported
 as causing missing panels, but I've triple checked mine and nothing's
 wrong.

 5. Themes with either no style.css, or no index.php file may have this
 issue apparently. I've checked that both are present, with no errors.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54007>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list