Scoped Handler
<?php
use DeepWebSolutions\Framework\Utilities\Hooks\Handlers\ScopedHooksHandler;
class MyClass {
public function output_my_content() {
do_action( 'before-my-awesome-output' );
// output ...
do_action( 'after-my-awesome-output' );
}
}
$scoped_handler = new ScopedHooksHandler(
'my-class-output-handler',
array( 'hook' => 'before-my-awesome-output' ),
array( 'hook' => 'after-my-awesome-output' )
);
$scoped_handler ->add_filter( ... );
$scoped_handler ->remove_action( ... );
$my_class = new MyClass();
$my_class->output_my_content();Last updated