New answers tagged


You can actually use the function you're using, you just need to use load-index.php (no need for globals if you don't need them): add_action('load-index.php', function(){ if(get_current_screen()->base == 'dashboard' && !wp_is_mobile()) wp_redirect(admin_url('edit.php')); });


I had exactly the same problem and I found a quite neat solution for it. When investigating, how Wordpress exactly handles the "Private-404" I found, that the post in question is in the queried_object. So you can actually check for that. Therefore in your 404.php do the following: $queried = get_queried_object(); if (is_a($queried, 'WP_Post') && ...

Top 50 recent answers are included