# imagify/2.3.2/vendor/wp-media/mcp-oauth/inc/Auth/Http404Trait.php

Imagify Image Optimization: Optimize Images | Compress &amp; Convert to WebP/AVIF, version 2.3.2. 31 lines.

- Page: https://pluginprobe.com/plugins/imagify/2.3.2/code/vendor/wp-media/mcp-oauth/inc/Auth/Http404Trait.php
- Raw: https://pluginprobe.com/plugins/imagify/2.3.2/raw/vendor/wp-media/mcp-oauth/inc/Auth/Http404Trait.php
- Modified: 2026-07-29T01:54:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/imagify/2.3.2/code/vendor/wp-media/mcp-oauth/inc/Auth/Http404Trait.php#L10-L20`.

```php
<?php
/**
 * Shared 404 helper for OAuth request handlers.
 */

declare( strict_types=1 );

namespace WPMedia\MCP\OAuth\Auth;

/**
 * Provides a clean 404 response for stale OAuth/discovery rewrite rules.
 */
trait Http404Trait {

	/**
	 * Force a clean 404 response.
	 *
	 * Used when a stale rewrite rule still routes a request to an OAuth or
	 * discovery endpoint after the OAuth server has been disabled, before
	 * rewrite rules have been flushed. Without this, WordPress's main query
	 * would fall through to the homepage instead of returning a 404.
	 *
	 * @return void
	 */
	private function force_404(): void {
		global $wp_query;
		$wp_query->set_404();
		status_header( 404 );
	}
}

```
