I’m struggling to use the $callback_args parameter of wp_add_dashboard_widget successfully.
The following code keeps displaying string(0)”” when dumping $args:
add_action( 'wp_dashboard_setup', 'sample_widget_setup' );
function sample_widget_setup() {
wp_add_dashboard_widget(
'sample_dashboard_widget',
'Sample Widget',
'sample_dashboard_widget_callback',
null,
'sample_string'
);
}
function sample_dashboard_widget_callback($args) {
var_dump($args);
}
How can I pass a variable to sample_dashboard_widget_callback?