Created
July 18, 2022 11:57
-
-
Save GauravKhupse/5c3392f74ef97f56c40ee1fbbc2bb451 to your computer and use it in GitHub Desktop.
Custom layout 404 hook not working with embedded link
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
function ensure_autoembed_on_embed_blocks( $block ) { | |
global $wp_embed; | |
if ( $block['blockName'] === 'core/embed' && strpos( $block['innerContent'][ 0 ], '</iframe>' ) === false ) { | |
$block['innerContent'][ 0 ] = $wp_embed->autoembed( $block['innerContent'][ 0 ] ); | |
} | |
return $block; | |
} | |
add_action('astra_404_content_template','ensure_autoembed_on_embed_blocks_404',10,1); | |
function ensure_autoembed_on_embed_blocks_404( $block ) { | |
add_filter( 'render_block_data', 'ensure_autoembed_on_embed_blocks', 10, 1 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment