Pass A Value From Outside To A Plugin Variable

You can with filter.

On your plugin :

 $value = 0;
 $value = apply_filter('get_value_from_function', $value);

Then on functions.php

add_filter('get_value_from_function', 'my_special_value_treatment', 10, 1);
function my_special_value_treatment ($value){
    return 1;
}

Leave a Comment