Redirecting your 404 page to the Home Page in WordPress

Add the following code in 404.php file in your theme’s folder. And If there is no 404.php file available in your theme, then create a blank php file. Paste the following code in there:

header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));