Use a Global Styles Filter to override the style:
add_filter( 'wp_theme_json_data_default', function ( $theme_json ){
$new_data = array(
'version' => 2,
'styles' => [
'blocks' => [
'core/embed' => [
'spacing' => [
'margin' => [
'top' => '2rem'
]
]
]
]
]
);
return $theme_json->update_with( $new_data );
});
An alternative that may also work is using the Global Styles UI in the (Site) Editor to change the default style of the block. Yet I think that’s not a viable option if you want your override to be part of a version-controlled theme.
Related Posts:
- WordPress Gutenberg Embed Blocks Are Not Responsive
- Once Again: How to Remove Option from Gutenberg Editor for Specific Block in theme.json
- How can I add a color picker to a custom Gutenberg block which includes the default system palette from theme.json?
- How to register a embed handler as a fallback to a oEmbed handler?
- WordPress block editor embeds not working in theme (single.php)
- Setting font sizes in theme.json
- Is it possible to disable font sizes on sub blocks only?
- How can I block embeds and show an individual preview image per block?
- How can I display instagram block with parse_block?
- Video, embed, html block usage out of the_content
- Block editor: Sandbox iframe shows outdated HTML
- How to set the background color of a template part (Header/Footer) in Twenty Twentythree?
- How to automatically reload style variant .json?
- How can I disable fontSizes of the Paragraph block inside the Quote block with theme.json?
- Different style options for the same block depending where it is used
- Not allowing my site to be embedded elsewhere via oEmbed
- Gutenberg – Shadow settings not available (theme.json)
- Theme.json: styles.typography.FontFamily renders as default font in front end but not editor
- Responsive rules with block themes and theme.json
- Set a default overlay color for the Core Cover block in theme.json
- How to trigger JS in gutenberg page load
- Change order/position of Gutenberg inspector control panel
- Gutenberg Inspector Controls
- serialize_blocks breaking html tags in content
- How to use getBlockIndex
- How to add code to `head` with WordPress 5.9 FSE (Full Site Editing)
- Block Editor: add an aria-label to an option inside a SelectControl
- Gutenberg: Get All Attributes From «core/image» Block
- Where on Github, or elsewhere, can I find the code for core-blocks?
- Gutenberg translation is not working
- How to add javascript function in the “save()” of gutenberg block?
- How to check if current admin page is Gutenberg editor? [duplicate]
- Possible add color palette for a block’s inner div instead of outer?
- Programmatically trigger the gutenberg save
- Gutenberg : in the backend, I just want to store a JSON object
- wordpress gutenberg url popover custom options
- Text Editors Are Hiding Text
- Disabling deleting reusable blocks except on the reusable block manager
- Gutenberg remove Most Used group
- Gutenberg. How To Register A Custom Block Style For Specific Post Type Only
- get used blocks in post and detect changing
- How to know whether you are editing a page or a post?
- How has my WordPress editor become so basic? Cannot add blocks or see anything visual
- Block Validation Fails: ‘
- Controlling the RichText component outside of blocks
- Custom Gutenberg Block: How to return plain HTML with save(), without escaping?
- Removing advanced section from brand new gutenberg block
- How to allow to add gradients to core/heading block?
- Gutenberg: How to update associated Terms of Custom Taxonomy to Current Post
- Gutenberg: How to float core table block in front-end of site?
- Register multiple styles / scripts in register_block_type
- How to automatically remove noreferrer from targetd link rel attribute, on render?
- Should there be concern about breaking Gutenberg updates to extended core blocks?
- How do I access onMerge, onReplace, onRemove functions for a Rich Text component in Gutenberg block code?
- How can Reusable Blocks be fully deleted?
- Make a Gutenberg Block that do WP_User_Query
- Extend Gutenberg block core/quote block
- How to get all attributes of a block in PHP?
- reload the gutenberg editer on taxonomy change
- Cannot enable Gutenberg editor [closed]
- Remove ‘type / to choose a block’ placeholder [duplicate]
- Start a line with – without converting to list
- Quickest way of developing custom Gutenberg Blocks
- gutenberg attributes
- How to register two blocks in the same plugin
- Trigger wp-embed via JavaScript to refresh iframe preview?
- Gutenberg: always show text color selector in editing bar
- How to lock innerBlocks within a block variation?
- How to fix: “The editor has encountered an unexpected error”?
- Compile a blocks src directory and main index.js entry file and output to different build dirs?
- Proxy External API request in PHP from Edit.js in Block Plugin
- How do I stop a dynamic Gutenberg component from re-rendering on every keystroke?
- WordPress does not hide content after “Read more” block added using gutenberg editor
- Gutenberg InnerBlocks allowed types and reusable blocks
- RSS feed WP widget vs Gutenberg Block?
- Gutenberg Custom Style problem with background image
- Theme options missing from edit page
- How to activate a new prop that a block introduces in a new release?
- “Updating failed” if any text includes “$v()”
- Multiple checkboxes Gutenberg control
- Block validation failed
- Loading column block style seperately
- wp-scripts start build hangs
- Block UI data table
- How to use correctly Panel in block/editor?
- Block editor – Too many requests for server host
- How to generate WordPress core blocks markup programmatically?
- How to restrict gutenberg block next post & previous post to same category?
- Where is getSite selector defined?
- How properly use social link block in template part
- How to self host fonts and have them show up in all the Full Site Block Editor Typography options, including global styling
- Conditionally Load JS for Block Style
- Custom WP Blocks (register_block_type) in a Parent Theme
- blocks.getSaveElement not working for core/social-link
- How do I load styles into the block editor admin screen?
- Removing Default Panels From Gutenberg Document Setting Panel (sidebar)
- Style priority in theme.json
- Disable block editor pre-publish sidebar for custom post type
- Default RichText Editor custom block fails validation
- Gutenberg editor styles not applied