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

Remove a panel from the settings? #6225

Closed
Soean opened this issue Apr 17, 2018 · 5 comments · Fixed by #11802
Closed

Remove a panel from the settings? #6225

Soean opened this issue Apr 17, 2018 · 5 comments · Fixed by #11802
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Extensibility The ability to extend blocks or the editing experience

Comments

@Soean
Copy link
Member

Soean commented Apr 17, 2018

A Question from camthor in the support forum:

Hi,

For the previous editor we had the possibility to remove a default meta box with remove_meta_box. That was useful if, for example, you wanted to create an alternative box for tags.

Is there anything equivalent for Gutenberg, i.e. to remove a panel from the settings on the right side? I was checking if you could simply hide the element, but all divs seem to have the class “components-panel__body” and no id. So there doesn’t seem to be a way how to select a particular panel. I would prefer, however, to remove the element already before rendering the page if that’s possible, not just with jQuery.

Thanks!

Source: https://wordpress.org/support/topic/how-to-programatically-remove-a-panel-from-the-settings/

@Soean Soean added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Apr 17, 2018
@youknowriad
Copy link
Contributor

youknowriad commented Jun 28, 2018

Let's consolidate in #6533

@genseirin
Copy link

This has been closed, so is there any solution how to remove the panel of the post tags?

@gziolo gziolo reopened this Nov 12, 2018
@gziolo gziolo added this to the WordPress 5.0 milestone Nov 12, 2018
@gziolo
Copy link
Member

gziolo commented Nov 12, 2018

is there any solution how to remove the panel of the post tags?

You can do the following as of today:

var el = wp.element.createElement;

function removeCategoryPanel( OriginalComponent ) {
	return function( props ) {
		if ( props.slug === 'category' ) {
			return null
		} else {
			return el(
				OriginalComponent,
				props
			);
		}
	}
};

wp.hooks.addFilter(
	'editor.PostTaxonomyType',
	'my-custom-plugin',
	removeCategoryPanel
);

Howeve it won't remove the panel's title. I will have a look tomorrow and find out if that is easy to do.

@gziolo gziolo added the [Feature] Extensibility The ability to extend blocks or the editing experience label Nov 12, 2018
@youknowriad
Copy link
Contributor

There's an API used in the options panel to hide these panels, I think we can just use it here?

@gziolo
Copy link
Member

gziolo commented Nov 13, 2018

There's an API used in the options panel to hide these panels, I think we can just use it here?

I have PR almost ready which adds another flag. The issue with the existing action is that you still would be able to enable it back using Options modal. My change will put the editor in the following state:

screen shot 2018-11-13 at 09 41 43

@gziolo gziolo added the Backwards Compatibility Issues or PRs that impact backwards compatability label Nov 13, 2018
@mtias mtias added [Status] In Progress Tracking issues with work in progress and removed [Type] Help Request Help with setup, implementation, or "How do I?" questions. labels Nov 14, 2018
@designsimply designsimply removed the [Status] In Progress Tracking issues with work in progress label Jan 30, 2019
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] Extensibility The ability to extend blocks or the editing experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants