WordPress.org

Make WordPress Core

#45281 closed defect (bug) (duplicate)

wp5.0-beta2: add custom field in editor even if not requested

Reported by: epointal Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.0
Component: Editor Keywords:
Focuses: Cc:

Description

When register custom post type like:

<?php
register_post_type(
    'custom-type',
            ....
    'supports' => array(
                         'title',
                         'excerpt',
                         'author'
                 )
);

Custom field is added to editor.
It seems come from:
wp-admin/includes/meta-boxes.php line 1365 function register_and_do_post_meta_boxes where is missing braces.

<?php
if ( post_type_supports($post_type, 'custom-fields') ) {
                $screen = get_current_screen();
                if ( ! $screen || ! $screen->is_block_editor() || (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ) ) {
                        add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => false, '__block_editor_compatible_meta_box' => true ) );
                }
}

Change History (1)

#1 @ocean90
17 months ago

  • Component changed from Customize to Editor
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hello @epointal, welcome to Trac!

Thanks for your report! I have reopened #45257 to get this fixed.

Note: See TracTickets for help on using tickets.