Gutenberg doesn’t give an option to remove specific heading levels from the editor interface. But, I think you can workaround using a bit of custom code (both PHP and some JavaScript). If you’re interested, try this. Add this custom snippet to your theme’s function.php file.
function remove_h1_from_editor() {
wp_enqueue_script(
'remove-h1',
get_template_directory_uri() . '/js/remove-h1.js',
array('wp-blocks', 'wp-dom-ready', 'wp-edit-post')
);
}
add_action('enqueue_block_editor_assets', 'remove_h1_from_editor');
Then, create a JavaScript file in your theme (in my code example, it’s located at /js/remove-h1.js) and add the following code:
wp.domReady(() => {
wp.blocks.unregisterBlockStyle('core/heading', 'h1');
});
I haven’t tested this, but it should work. If it doesn’t work on your theme, try tweaking the code accordingly.
Related Posts:
- Add pre-publish conditions to the block editor
- How does Gutenberg handle translations in React?
- How can I access core/paragraph textColor in a block template
- Saving post meta using the new EntityProvider APIs
- Implement Panel Color Inspector Control in Gutenberg
- gutenberg dynamic block is returning 404
- Gutenberg InspectorControls is deprecated, how to add custom block settings?
- Why is onChange={ ( content ) => setAttributes( { content } )} now used?
- How to set column widths in a CPT block template?
- Access GutenBerg data with Javascript?
- Gutenberg: How to Change Post Status Programmatically?
- Adding a custom PanelColorSettings control to a core block, and using the color slug in a custom className
- Enhancing Gutenberg featured image control
- Is it possible to create column width presets in Gutenberg?
- How to define a Block Style in an Innerblocks template
- Option for removing block not appearing in custom gutenberg block
- Testing custom themes / plugins under Gutenberg
- Gutenberg LinkControl suggestionsQuery not working
- Gutenberg – How to prevent block from being deleted and reordered/moved
- WordPress Gutenberg Columns block
- Gutenberg InnerBlocks predefined block supports
- Is it possible to bulk migrate all deprecated instances of a gutenberg block?
- How to Add a Container Class to Standard Gutenberg Blocks
- How to display InnerBlocks in render callback
- How to check if post has Video or Gallery block in Gutenberg blocks?
- Gutenberg – button to parse and format all blocks?
- Custom WP Block using Inner Blocks crashes editor, doesn’t save content
- Gutenberg Button Border Radius Default
- Disable title block on edit screen for a custom post type
- Gutenberg: Block validation fails if editor is reloaded or post is edited. data.getBlocks(); is empty in save function
- Delete a Gutenberg Block Programmatically?
- Can Gutenberg be used as an editor on a page?
- How do a I add an attribute to element (when using block theme)?
- How to transform block variant to default version?
- How can I add a color picker to a custom Gutenberg block which includes the default system palette from theme.json?
- How to makes Custom Post Type posts as Gutenberg’s patterns?
- Can’t run WP e2e-test-utils because the browser exits on login?
- Modify the InnerBlocks ‘Add block’ block appender label
- wp_schedule_single_event issue with save_post hook in gutenberg
- Gutenberg TextareaControl escapes html
- Gutenberg extending the existing class
- Creating Block templates with ‘core/heading’ other than level 2
- how to trigger a Gutenberg image gallery lightbox
- Remove or rename “Default” from Gutenberg typography settings
- How to put and components inside in Gutenberg block
- Wp-script package stop to work
- CheckboxControl does not visible change
- How to import Reusable Blocks programatically?
- Remove formatting in rich text with Gutenbergs Block editor
- Setting font sizes in theme.json
- Get selected block every time a new block is selected in Gutenberg
- How do I include and iframe in a Custom Block?
- Gutenberg InnerBlocks with ACF Blocks – How to enable multiple buttons?
- How to work with multilingual sites using the full site editor and block themes?
- Trying to edit a page returns the editor encountered an unexpected error
- Block patterns: Any way to reset the pattern to whatever is in the code?
- Block variation / Variation API scope “transform”
- Is there a function to “blockify” html?
- Custom style css doesn’t work in Gutenberg preview
- Gutenberg get list of all custom image sizes
- How to set a template part area?
- Upgraded to wordpress 5.7 and now I can’t select myself as a post author
- Stop JSON code from injecting into gutenburg classic block
- Extend the “Convert to Blocks” feature to add additional functionality
- Blocks. How to store default settings?
- Gutenberg/WordPress – Limit number of categories
- Can the Gutenberg editor be toggled closed?
- Guenberg Block Not Saving – When additional div added
- How to open WordPress media create/edit Gallery Dialog
- Pages are editable in Gutenberg, but posts are coming up in classic editor
- Add a button to the Gutenberg editor header
- Disabling gutenbeg slow down post saving
- How to solve react dom ‘removeChild’ on Node error while google translate extension is on and selecting any core block [closed]
- Can I strip WordPress classes from blocks?
- How to list all registered blocks
- How to automatically reload style variant .json?
- Strange behavior of blocks in the editor
- Block editor not loading with rest api custom code
- In Full Site Editing, how do I get the templates I created to appear in the site editor when populating a new page?
- Dynamically add table of contents and add anchor based on heading innerHTML
- How to defer block.json scripts?
- Block validation: Block validation failed – Custom WordPress Gutenberg Block Fails In Editor when reloaded
- How can I prevent a user from selecting exactly one of two (not both or none) categories on a post?
- WordPress custom Block showing error in Posts editor but working in Pages editor
- Implementation of React-Datepicker component with Gutenberg in WordPress
- How disable settings on core/image (Gutenberg) block
- WP dynamic block – change content without saving
- Innerblocks isn’t adding new blocks when template changes
- What happened to the Menu Order option for posts (for ordering posts by Menu Order in Block Editor (Gutenberg)?
- How to prevent the core/group block from being ungrouped?
- Get FontSize from the InspectorControls Standard Control (typography.fontSize)
- Splide carousel block – innerBlocks not selectable after innerBlocks change
- Translating Gutenberg Block – JSON Translation Files Not Loading
- ServerSideRender crashes block in editor
- How to get Gutenberg pattern sync status for custom pattern listings table?
- Add/remove capability for blocks theme nav menu
- what is the function of the view.js file?
- What is the correct way to send Markdown code via the API?
- How do I edit a block pattern of mine?
- How to apply a class to a portion of text in a paragraph block?