<?php
/**
 * Plugin Name: Disable 404 Queries
 * Description: Disables the default WordPress 404 handling, preventing unnecessary database queries.
 * Version: 1.0
 * Author: Your Name
 */

add_filter( 'template_redirect', function() {
    if ( is_404() ) {
        // Stop WordPress from processing further
        status_header( 404 );
        exit; // End the execution completely
    }
}, 0 ); // Priority 0 ensures this runs as early as possible