如果不考虑向后兼容性(仅在PHP 5.3及更高版本下运行时有效),可以使用匿名函数:
add_action( \'init\', function() {
$pluralName = \'PluralName\';
$singularName = \'SingularName\';
custom_poster( $pluralName, $singularName );
}
);
或关闭
$singularName = \'Singular Name\';
$pluralName = \'Plural Name\';
add_action( \'init\', function() use ($singularName, $pluralName) {
custom_poster( $pluralName, $singularName );
} );