[wp-trac] [WordPress Trac] #45281: wp5.0-beta2: add custom field in editor even if not requested

WordPress Trac noreply at wordpress.org
Sun Nov 4 17:12:47 UTC 2018


#45281: wp5.0-beta2: add custom field in editor even if not requested
--------------------------+-----------------------------
 Reporter:  epointal      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Customize     |    Version:  5.0
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When register custom post type like:
 {{{#!php
 <?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
 <?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 ) );
                 }
 }
 }}}

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


More information about the wp-trac mailing list