I want to hook into the subscriber role index.php page (wp-admin/index.php) to add some custom content outside of the widgets.
This admin_init works for all admin pages:
add_action( 'init', 'test_init');
function test_init(){
add_action( 'admin_init', 'test_admin_init');
}
function test_admin_init() {
echo "Test Admin Init";
}
But this doesn't work for only subscribers:
add_action('admin_init', 'add_to_dashboard');
function add_to_dashboard() {
if (current_user_can('subscriber') && is_admin()) {
add_action( 'admin_init', 'test_admin_init');
}
}
function test_admin_init() {
echo "Test Admin Init";
}
And how would this work for subscribers for only index.php and not profile.php?
Is this the wrong way to go about adding custom content to the subscriber's admin index.php page?