Skip to content

Instantly share code, notes, and snippets.

@morganestes
Last active August 12, 2020 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morganestes/b660d01ac8e68994e150abfbf74c933b to your computer and use it in GitHub Desktop.
Save morganestes/b660d01ac8e68994e150abfbf74c933b to your computer and use it in GitHub Desktop.
Exmple of how to extend Gutenberg with JS hooks
import { applyFilters, addFilter } from "@wordpress/hooks";
addFilter('plugins.registerPlugin', 'bigwing/editor-sidebar', (settings, name) => {
console.log(settings, name);
if ('bigwing-editor-sidebar' !== name) {
return settings;
}
console.log(settings);
if (settings.hasOwnProperty('icon')) {
settings.icon = '';
}
return settings;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment