Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block level settings: remove WP filters in Gutenberg #49598

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/block-supports/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function _gutenberg_add_block_level_preset_styles( $pre_render, $block ) {
)
);

// include preset css classes on the the stylesheet.
// include preset css classes on the stylesheet.
$styles .= $theme_json_object->get_stylesheet(
array( 'presets' ),
null,
Expand All @@ -131,6 +131,8 @@ function _gutenberg_add_block_level_preset_styles( $pre_render, $block ) {

return null;
}

// Remove WordPress core filter to avoid rendering duplicate settings style blocks.
remove_filter( 'render_block', '_wp_add_block_level_presets_class', 10, 2 );
remove_filter( 'pre_render_block', '_wp_add_block_level_preset_styles', 10, 2 );
add_filter( 'render_block', '_gutenberg_add_block_level_presets_class', 10, 2 );
add_filter( 'pre_render_block', '_gutenberg_add_block_level_preset_styles', 10, 2 );