Skip to content

Instantly share code, notes, and snippets.

@markhowellsmead
Created June 5, 2024 13:11
Show Gist options
  • Save markhowellsmead/0583d14aa083f0bf7fea1e774512f1a3 to your computer and use it in GitHub Desktop.
Save markhowellsmead/0583d14aa083f0bf7fea1e774512f1a3 to your computer and use it in GitHub Desktop.
Add a do_action using the render_block filter
<?php
namespace PT\MustUse\Blocks\CoreEmbed;
class Block
{
public function run()
{
add_filter('render_block_core/embed', [$this, 'render'], 10, 2);
}
public function render($html, $block)
{
do_action('ptmustuse/blockbefore/core-embed', $html, $block);
return $html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment