function is404_redirect_home() { if( is_404() ){ wp_safe_redirect( home_url( '/' ) ); exit(); } } add_action( 'template_redirect', 'is404_redirect_home' );