Gutenberg: Add theme support option to disable gradient picker

Created on 31 Oct 2019  路  6Comments  路  Source: WordPress/gutenberg

In the same way that there is an option add_theme_support('disable-custom-colors');.

[Feature] Themes [Type] Enhancement

Most helpful comment

For anyone wondering why the above snippet no longer works. It's been changed to:

add_theme_support('editor-gradient-presets', []);
add_theme_support('disable-custom-gradients', true);

Not sure when that happened, but removing the __experimental- prefix works for me using WordPress 5.4

All 6 comments

Related: #18171 #17774

It looks like this was added as an experimental feature only very recently:
https://github.com/WordPress/gutenberg/commit/5e68cdce7c8ed4c5fb831c4ccd89ade97524f073#diff-bda1f53deac273d361a56c63a5b90adeR157

@jorgefilipecosta Any further info the reporter should be aware of for this issue?

Hi @markhowellsmead, as @talldan referred this feature is now available in an experimental state.
It is possible to completely disable gradients using:
add_theme_support(聽'__experimental-editor-gradient-presets',聽array() ); add_theme_support(聽'__experimental-disable-custom-gradients',聽true ); .

Thank you for reporting this issue!

Great! Thanks @jorgefilipecosta!

For anyone wondering why the above snippet no longer works. It's been changed to:

add_theme_support('editor-gradient-presets', []);
add_theme_support('disable-custom-gradients', true);

Not sure when that happened, but removing the __experimental- prefix works for me using WordPress 5.4

Hi @Ahrengot, thank you for sharing the new code, since the original discussion the APIs were stabilized and now the experimental prefix should not be used.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mhenrylucero picture mhenrylucero  路  3Comments

jasmussen picture jasmussen  路  3Comments

maddisondesigns picture maddisondesigns  路  3Comments

spocke picture spocke  路  3Comments

nylen picture nylen  路  3Comments