WordPress how to redirect error 404 page to home page or any page

My WordPress theme didn’t have a 404.php page included and I wanted to make any error 404 “page not found” go to the home page. This method would go to any page you specify. This is a somewhat hard coded solution and it is a permanent redirect in this case. Contents of 404.php: <?php header(“Status: […]