How to create 404 page in WordPress
404 page is pretty simple. According to WordPress this page should be named as
404.php and also WordPress doesn’t have any recommendation for this page. So, you can create your own.
This page is not about WordPress functions and it is about HTML/CSS. Lets discuss the code for this page. Lets create a page called
404.php in your theme directory. I am assuming you are showing header and footer in the 404 template.
<?php <?php /* * 404 error template */ get_header(); ?> <div class="error-wrapper"> <h1>404</h1> <h2>Page Not Found</h2> </div> <!—/ error wrapper end —> <?php get_footer(); ?>
This is just a syntax to show you how 404 error template should be. You do not want to worry about any other things. WordPress take care about the functionality of this page. You just need to follow the naming conventions. Other all stuff will managed by WordPress then.