I want to use the same filter hook in different locations, and I just want to make sure this is OK to do so ( preliminary test shows it works, but I am not 100% sure it is OK to do so).
So the add_filter(‘check_powers’, …. ) is in one location only ( not that it matters)
function define_user_powers()
{
if ( user_is_powerful() ){
add_filter('check_powers', 'give_super_power');
}
}
function give_super_power( $powers ){
$powers = true;
return $powers;
}
But the apply_filters(‘check_powers’) is in several locations:
function kick_ass()
{
$powers = apply_filters('check_powers', false );
if ( $powers ) {
do_smthng();
}
}
function fly()
{
$powers = apply_filters('check_powers', false );
if ( $powers ) {
do_smthng_else();
}
}
All questions i have found relates to the other way around ( multiple add_filter to same hook).