I am trying to set up a 404 page for my WordPress site. I have added a 404.php file to my theme directory and it works correctly.

Is there a way to create a 404 page specifically for the dashboard?

Currently if the user encounters a 404 page in the admin area then they have to hit the back button or go to the admin toolbar and select dashboard.

It would be good if they would instead be shown a 404 page that exists within the admin area ie; with the sidebar displaying.

Anyone managed to achieve anything similar?

  • Not sure this can be done with WordPress itself, but you can put a .htaccess file in your wp-admin folder and create a PHP/HTML file for it.
    – Cedon
    Apr 8 '17 at 13:03

To tell your web server to use your custom error files, you'll need to edit the .htaccess file in the main directory (where main index.php file resides) of your WordPress installation.

To ensure the server finds your 404 page, add the following line to your .htaccess file:

ErrorDocument 404 /wordpress/index.php?error=404

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.