Forked from mihdan/wp-replace-figure-with-p-for-gutenberg.php
Created
July 2, 2025 13:19
-
-
Save dexit/5e1602b4b4d031570ada583bd1bb7bc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'render_block', | |
function ( $block_content, $block ) { | |
if ( 'core/image' === $block['blockName'] ) { | |
$block_content = str_replace( | |
array( '<figure ', '</figure>' ), | |
array( '<p ', '</p>' ), | |
$block_content | |
); | |
} | |
return $block_content; | |
}, | |
10, | |
2 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment