By Adham Mohamed


2019-03-14 19:20:23 8 Comments

Is there any way to hide specific Gutenberg block settings from users?

For example: "Crop Images", "Link To", and "Additional CSS Class"

enter image description here

1 comments

@RiddleMeThis 2019-03-20 19:48:58

As far as I know, as of right now there isn't a built-in way of removing unwanted inspector controls.

You can read THIS POST, but the gist is that there are proposed solutions out there and devs are aware but they have bigger fish to fry atm, apparently.

With that said, I guess you are left with 2 options.

1 - Copy the block in question and remake it without the options

This could be difficult, especially if you don't have any JS and/or block editor dev experience.

2 - Use some crazy CSS selector to add display:none to the options

This is probably easier but you still have to figure out the right CSS selector, which is difficult due to no IDs or classes on the option elements.

Neither of these solutions are great but I think thats what we have, for now...

@Adham Mohamed 2019-03-21 09:47:37

Thanks @RiddleMeThis for your answer, I read the post you attached above, But i don't know where can i insert this code let controls = {///} , and when i added function removeGalleryControls( controls, block ) {} in theme function I got error on the comma between ( control , block )! Should i adding let control within javascript or on my theme function.php? Gutenberg is so complicated to me :(

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] Pre-set CSS class into custom block/template

  • 2019-04-29 09:05:26
  • kevinckc
  • 43 View
  • 0 Score
  • 1 Answer
  • Tags:   block-editor

1 Answered Questions

Gutenberg: Sidebar for specific post type

0 Answered Questions

How to wrap Gutenberg blocks into a custom container (without using HTML blocks)?

  • 2019-04-15 08:25:19
  • Bunjip
  • 64 View
  • 0 Score
  • 0 Answer
  • Tags:   block-editor

4 Answered Questions

[SOLVED] Are there Gutenberg container blocks?

  • 2018-10-04 23:35:55
  • Wes Modes
  • 3503 View
  • 4 Score
  • 4 Answer
  • Tags:   css block-editor

2 Answered Questions

[SOLVED] Gutenberg InspectorControls is deprecated, how to add custom block settings?

  • 2019-01-26 22:42:28
  • user382738
  • 516 View
  • 2 Score
  • 2 Answer
  • Tags:   block-editor

0 Answered Questions

Adding Class to Default Wordpress Gutenberg Blocks?

  • 2018-12-10 20:49:20
  • user9664977
  • 198 View
  • 1 Score
  • 0 Answer
  • Tags:   block-editor

0 Answered Questions

Show or hide custom meta box not work with Gutenberg

1 Answered Questions

[SOLVED] Hide or show Gutenberg custom block using date range

  • 2018-11-14 20:10:15
  • Jim-miraidev
  • 528 View
  • 2 Score
  • 1 Answer
  • Tags:   block-editor

0 Answered Questions

How to Add a Container Class to Standard Gutenberg Blocks

  • 2018-11-12 19:31:35
  • user9664977
  • 168 View
  • 2 Score
  • 0 Answer
  • Tags:   block-editor

0 Answered Questions

How to use styled-components within a custom Gutenberg block?

Sponsored Content