When an action is defined, the parameters passed to the callback are defined as well. For example, you can define an action with 4 parameters:
$a = 1;
$b = 2;
$c = 3;
$d = 4;
do_action( 'name_of_my_action', $a, $b, $c, $d );
Then, when you hook in that action, you can tell how many of those parameters will be used; the value of those params are the values assigned when the action was defined. For example, you may want to use only 2:
// The fourth parameter is the number of accepted
// parameters by the callback, in this case want only 2
// The parameters are passed to the callback in the same order
// they were set when the action was definied and with the same value
add_action( 'name_of_my_action', 'my_action_callback', 10, 2 );
function my_action_callback( $a, $b ) {
// The value of $a is 1
var_dump( $a );
// The value of $b is 2
var_dump( $b );
}
If you look at the definition of init
action, eiter in docs or source code (In WodPress 4.3.1 it is in line 353 of wp-settings.php file), there is no parameters passed to the callback.
If you want to pass custom parameters to actions and filters callbacks, you have several options. I recommend this question and its answer to learn about it. For example, using anonymous functions:
$custom = 1;
add_action( 'init', function () use $custom {
// The value of $custom is 1
var_dump( $custom );
}, 10, 2 );