Skip to content

Instantly share code, notes, and snippets.

View jeremyphillips's full-sized avatar

Jeremy Phillips jeremyphillips

View GitHub Profile
@jeremyphillips
jeremyphillips / wp-extend-gutenberg.js
Last active July 6, 2024 12:29
Extend Wordpress Gutenberg blocks via React
const { __ } = wp.i18n;
const { addFilter } = wp.hooks;
const { createHigherOrderComponent } = wp.compose;
const { Fragment, cloneElement } = wp.element;
const { InspectorControls } = wp.editor;
const { PanelBody, ToggleControl } = wp.components;
const blockHasParent = ( clientId ) => clientId !== wp.data.select( 'core/editor' ).getBlockHierarchyRootClientId( clientId );
// Filter supports props
addFilter(