Function arguments in add_action() to init
I am looking to pass arguments in my function to add_action(), but
apparently I need to do this through do_action. My problem is the
add_action tag is 'init', which I think will cause issues if I run it
again/prematurely. Any ideas?
function taxonomy_equipment( ) {
$name = "Equipment";
$labels = array(
'name' => _x( $name, 'taxonomy general name' ),
'singular_name' => _x( $name, 'taxonomy singular name' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
);
register_taxonomy( str_replace(' ', '', strtolower($name)),
'exercise', $args );
}
add_action( 'init', 'taxonomy_equipment', 0 );
I want to pass $name as an argument.
No comments:
Post a Comment