Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"hidden_meta_boxes" Filter Does Not Work When Gutenberg and Classic Editors are Active #9596

Closed
arkytn opened this issue Sep 4, 2018 · 2 comments
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Meta Boxes A draggable box shown on the post editing screen Needs Testing Needs further testing to be confirmed. [Status] Needs More Info Follow-up required in order to be actionable. [Type] Bug An existing feature does not function as intended

Comments

@arkytn
Copy link

arkytn commented Sep 4, 2018

Describe the bug
When the Gutenberg and Classic editor plugins are active, the "hidden_meta_boxes" filter does not hide any meta boxes.

To Reproduce
Steps to reproduce the behavior:

  1. add_filter('hidden_meta_boxes', 'on_hidden_meta_boxes', 10, 3 );
    

function on_hidden_meta_boxes($hidden, $screen, $use_defaults){
if($screen->id == 'asset'){
$hidden[] = 'commentstatusdiv';
$hidden[] = 'commentsdiv';
$hidden[] = 'page-links-to';
$hidden[] = 'pageparentdiv';
}

return $hidden;  

}

  1. Meta boxes will not be hidden .

Expected behavior
Should hide the hidden set of metaboxes and un-check the Screen Options for those boxes.

Desktop (please complete the following information):

  • OS: [e.g. Win10, Linux]
  • Browser [e.g. All]
  • Version [e.g. WP 4.9.8]

Additional context
Gutenberg Version 3.7.0
Classic Editor Version 0.4

@ianbelanger79 ianbelanger79 added [Type] Bug An existing feature does not function as intended [Feature] Meta Boxes A draggable box shown on the post editing screen Needs Testing Needs further testing to be confirmed. labels Sep 4, 2018
@danielbachhuber danielbachhuber added the Backwards Compatibility Issues or PRs that impact backwards compatability label Sep 11, 2018
@danielbachhuber
Copy link
Member

Thanks for the report, @arkytn.

Can you try changing your hook priority to 11?

add_filter('hidden_meta_boxes', 'on_hidden_meta_boxes', 11, 3 );

Gutenberg has some code to disable hidden metaboxes, because there isn't corresponding Screen Options UI for managing them. It may be that we need to apply the Gutenberg code on an earlier priority. Previously #7570 #9232

@danielbachhuber danielbachhuber added the [Status] Needs More Info Follow-up required in order to be actionable. label Sep 11, 2018
@arkytn
Copy link
Author

arkytn commented Sep 11, 2018

Very good. The higher priority did indeed solve the problem. Thank you

@arkytn arkytn closed this as completed Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Meta Boxes A draggable box shown on the post editing screen Needs Testing Needs further testing to be confirmed. [Status] Needs More Info Follow-up required in order to be actionable. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants