Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#45285 closed defect (bug) (wontfix)

Custom Fields do not show up

Reported by: websupporter's profile websupporter Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.0
Component: Editor Keywords:
Focuses: Cc:

Description

On a clean install, custom fields do not show up when I toggle it in the options. The problem is, the class hide-if-js is attached to the box, which hides the box. This is because the current implementation does not respect the outcome of get_hidden_meta_boxes().

Instead of introducing a new user meta to implement whether to show or to hide the box, I would suggest to rely on get_hidden_meta_boxes()

Attachments (2)

get_hidden_meta_boxes.diff (2.9 KB) - added by websupporter 6 years ago.
Use get_hidden_meta_boxes() information whether to show or hide the box
get_hidden_meta_boxes-2.diff (2.9 KB) - added by websupporter 6 years ago.
Removes a tab, which is too much.

Download all attachments as: .zip

Change History (7)

@websupporter
6 years ago

Use get_hidden_meta_boxes() information whether to show or hide the box

@websupporter
6 years ago

Removes a tab, which is too much.

#1 @SergeyBiryukov
6 years ago

  • Milestone changed from Awaiting Review to 5.0

#3 @websupporter
6 years ago

#45282 seems to fix this problem currently as well, at least

$hidden_class = ( ! $screen->is_block_editor() && in_array( $box['id'], $hidden ) ) ? ' hide-if-js' : '';

seems to be another solution to it. This effectively would mean to not take get_hidden_meta_boxes() into account. So, this function from now on serves only on \WP_Screens which do not serve Gutenberg.

There are two filters:

  • default_hidden_meta_boxes
  • hidden_meta_boxes

They would have no longer effect for Gutenberg-Screens.

Thinking about it, this might make sense to deprecate those filters for Gutenberg-Screens.

Given this usage:

<?php
 add_filter(
        'hidden_meta_boxes',
        function() {
                return ['postcustom'];
        }
 );

What hidden_meta_boxes did for the old editor was essentially always hide the custom fields box unless the author enabled it again. In this case for this page view, it would be visible again and would be hidden, once he clicks update again. Currently I can't see a really good use case for this and maybe Gutenberg is a good opportunity to say, we say goodbye to this behavior.

Last edited 6 years ago by websupporter (previous) (diff)

#4 @pento
6 years ago

  • Milestone 5.0 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Thanks for the bug report and patch, @websupporter!

I'm inclined to agree that this functionality isn't appropriate for the block editor interface: custom fields is kind of a special case, it's the only core meta boxes that we're reusing, everything else has been reimplemented, and doesn't identify as a meta box at all.

#5 @websupporter
6 years ago

agreed. thanks for the feedback @pento

Note: See TracTickets for help on using tickets.