Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alinademi/368cbc021466ff335b8eefed35974a53 to your computer and use it in GitHub Desktop.
Save alinademi/368cbc021466ff335b8eefed35974a53 to your computer and use it in GitHub Desktop.
<?php
function rh_filter_the_content( $the_content = '' ) {
$blocks = parse_blocks( $the_content );
$new_block = array(
'blockName' => 'core/paragraph',
'attrs' => array(),
'innerBlocks' => array(),
'innerHTML' => '<p>Hello World</p>',
'innerContent' => array(
'<p>Hello World</p>',
),
);
$blocks[] = $new_block;
return serialize_blocks( $blocks );
}
add_filter( 'the_content', 'rh_filter_the_content', 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment