Gutenberg Blocks – Cannot retrieve block saved attributes in edit post

The block validation failed because the editor did not parse the attributes from all images (in the saved post content), and it’s because your save function is returning only one .slider-item div containing multiple img tags, like so: <div class=”slider-item”> <img src=”…” data-id=”123″ /> <img src=”…” data-id=”456″ /> … </div> And what should actually be … Read more

WordPress npm run build and start only outputs wp-scripts start but does nothing

I’ve managed to pull and get it to run as I would expect. $ npm run start:random-game > [email protected] start:random-game C:\Users\…\game-review-block > wp-scripts start blocks/random-game/src/index.js –output-path=blocks/random-game/build/ <i> [LiveReloadPlugin] Live Reload listening on port 35729 asset index.js 25.4 KiB [emitted] (name: index) 1 related asset asset style-index.css 858 bytes [emitted] (name: style-index) (id hint: style) 1 … Read more

How can I import one custom block into another?

You cannot embed blocks as react components this way, and you should not try to use other blocks as user interface components by setting innerblocks with a locked template. Instead, use 2 filters to modify the core/embed block: Use editor.BlockListBlock on core/embed to modify the edit component, wrapping it in your own component that has … Read more

CheckboxControl does not visible change

Solution found: const { __ } = wp.i18n; const { useSelect, useDispatch } = wp.data; const { PluginDocumentSettingPanel } = wp.editPost; const { CheckboxControl, PanelRow } = wp.components; const Sidebar = () => { const { postMeta } = useSelect( ( select ) => { return { postMeta: select( ‘core/editor’ ).getEditedPostAttribute( ‘meta’ ), }; } … Read more

Adding content to Page settings rather than Block settings

Ahh — I found it. It is called the PluginDocumentSettingPanel and can be imported from @wordpress/edit-post. import { registerPlugin } from ‘@wordpress/plugins’; import { PluginDocumentSettingPanel } from ‘@wordpress/edit-post’; const PluginDocumentSettingPanelDemo = () => ( <PluginDocumentSettingPanel name=”custom-panel” title=”Custom Panel” className=”custom-panel” > Custom Panel Contents </PluginDocumentSettingPanel> ); registerPlugin( ‘plugin-document-setting-panel-demo’, { render: PluginDocumentSettingPanelDemo, icon: ‘palmtree’, } );