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
- Embeds (YouTube, Spotify) Work Live but Won’t Load in Block Editor [closed]
- Implement Panel Color Inspector Control in Gutenberg
- Gutenberg InspectorControls is deprecated, how to add custom block settings?
- How should you internationalize javascript spread in multiple files but build in one?
- Why is onChange={ ( content ) => setAttributes( { content } )} now used?
- How to set column widths in a CPT block template?
- Access GutenBerg data with Javascript?
- Only show focused toolbar for Gutenberg Block with Multiple text fields
- 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 InnerBlocks predefined block supports
- 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?
- Import external data into post using custom Gutenberg block
- How do a I add an attribute to element (when using block theme)?
- How to transform block variant to default version?
- 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
- Do I need wp-tinymce-js?
- wp_schedule_single_event issue with save_post hook in gutenberg
- Block editor fails to update HTML section when the word “from” is in source code
- Gutenberg extending the existing class
- WordPress Full Site Editing: How can I access my posts listing page?
- How Do I Prevent An Image From Automatically Adjusting In Guttenberg Block Gallery?
- How to reload data stored for a sever side gutenberg block in the editor
- Using wp_set_script_translations without manually registering the script
- Update number of posts when attribute changed
- Connect WordPress and react front-end
- WordPress Dynamic Block with multiple checkboxes
- Embedded block editor in block editor
- useSelect in block Edit always returns default store value
- Count Gutenberg blocks on the front-end?
- How to call a react hook on edit of registerBlockType?
- add arrow icon next to read more link on latest posts gutenberg block
- Create a trailing block with programatically generated Gutenberg columns
- How to make attributes unique to Gutenberg blocks
- How to check title is being entered in Title Case?
- Create Gutenburg Block to render inline SVG
- Gutenberg blocks not full width
- Show Gutenberg facebook embed with a custom theme
- How to extend the URLPopover render settings for the paragraph Gutenberg block?
- How to make a block similar to another block
- Gutenberg: How to enqueue scripts conditionally in render_callback by checking for an attribute?
- How can I reintroduce autocompletion of Gutenberg components in Visual Code?
- Blocks – any way to have editor honor width percentages on child blocks?
- Using `esc_attr( get_block_wrapper_attributes() )`, results in `class=””wp-block-foo””`
- Narrow paragraph block aligned to left of “wrapper”
- How to display dynamic block editor on front-end?
- Enable varying text for Phone, Tablet and Desktop
- Pass component name in onChange [closed]
- Add another option to default link control settings panel?
- With full-site-editing menus, how do I create a non-linking top-level menu item with linking sub-pages
- How can I render a built-in Gutenberg block with InnerBlocks outside of the block editor?
- How do I add filters in Twenty-Twenty-Three without a functions.php?
- What is the proper way of using React Hooks in Gutenberg on frontend?
- How to add Gutenberg editor on frontend page?
- WordPress gutenberg block serverside rendering html elements not showing up
- Gutenberg: change block Components Popover properties
- Unable to register a block using block.json in Block Editor
- $attributes not defined in block.json PHP template for ACF blocks
- add_editor_style now copying html styles to .editor-styles-wrapper?
- Building my first ever Gutenberg block
- Add custom block to submenu variation
- Unable to add blocks in wordpress posts
- How to get Gutenberg pattern sync status for custom pattern listings table?
- Setting “Open in New Tab” for Link Control to be checked by default
- Add Gallery items programmatically inside an InnerBlock
- Is it possible to add settings to a search block in Gutenberg?
- Block markup not working inside WP_Query
- What is the name of the user capability to read a synced pattern inside a post?