post_type_supports($post_type, ‘custom-fields’)
-
Hi
using 5.0-beta2-43859
there seems to be an issue where ‘custom-fields’ are always shown in the post editor for a custom post type, even if they were not enabled when registering the post type (and it also throws PHP Notices)i might be wrong of course, but wrapping the codeblock in brackets appears to fix this i.e currently it’s
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 ) ); }
simply doing this seems to fix the problem
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 ) ); } }
file in question: /wp-admin/includes/meta-boxes.php (approx. line 1363)
(of course, maybe i am missing something entirely and am looking in the wrong place, alwasy a possibility of course)
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘post_type_supports($post_type, ‘custom-fields’)’ is closed to new replies.