Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#45281 closed defect (bug) (duplicate)

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

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

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
8 years ago

  • Component CustomizeEditor
  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed

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.