Custom 404

<?php

// briellaerd
function func_404_redirect($query){
  global $wp_query;
  if(is_404()) {
    $post = get_post(4027);
    $wp_query->queried_object = $post;
    $wp_query->is_single = true;
    $wp_query->is_404 = false;
    $wp_query->queried_object_id = $post->ID;
    $wp_query->post_count = 1;
    $wp_query->current_post=-1;
    $wp_query->posts = array($post);
  }
}
add_filter('template_redirect', __NAMESPACE__ . '\\func_404_redirect');
Last Updated:
Contributors: Niek Vlam, Suite Seven