Gutenberg
Here are some helpful links for learning more about Gutenberg
Built In Block Editing Components
Gutenberg Packages
getEntityRecords
Block Library
Theme.JSON
Locking Blocks
More Block Data
wp.domReady(() => {
// wp.blocks.unregisterBlockStyle("core/quote", ["default", "plain", "large"]);
// THIS CAN SHOW THE BLOCK OBJECTS IN THE CONSOLE OF THE PAGE EDITOR
wp.blocks.getBlockTypes().forEach((block) => {
console.log("block :", block);
});
});
Removing Editor Panels
wp.domReady(() => {
wp.blocks.unregisterBlockStyle("core/quote", ["default", "plain", "large"]);
wp.data.dispatch("core/edit-post").removeEditorPanel("discussion-panel");
wp.data.dispatch("core/edit-post").removeEditorPanel("template");
});
We can use wp.data.dispatch
to remove editor panels as shown above.
We can also toggle them open by default as you can see below.
if (!wp.data.select("core/edit-post").isPanelOpened("featured-image")) {
wp.data
.dispatch("core/edit-post")
.toggleEditorPanelOpened("featured-image");
}
Last updated
Was this helpful?