Trying to setup a redirect for Wordpress backend. I have used this code:
function redirected_admin_pages(){
global $pagenow;
if($pagenow == 'edit.php'){
wp_redirect('edit.php?post_status=publish&post_type=post');
exit;
}
}
add_action('admin_init', array($this, 'redirected_admin_pages'));
I based it on the answer here https://wordpress.stackexchange.com/questions/52114/admin-page-redirect
For some reason I cant get it work. What am I doing wrong?