This has been an issue in core for a while, http://core.trac.wordpress.org/ticket/10722.
The simplest solution is to just overwrite the headers on ‘template_redirect’. You can replace them as long as you haven’t started any output yet, which you shouldn’t have at this point. Just call status_header( 200 );
No cache headers are also sent when the WP Class sends the 404 headers, so you’ll probably want to replace those with information based on the content you’re pulling from that PHP page.
Related Posts:
- Filter to change the content of 404 page
- A tool to analyze rewrite rules? [closed]
- Making a plugin file accessible via url rewrite?
- How to Rewrite WordPress URL for a Plugin
- Custom Rewriting to Plugin with Parameters
- Add rewrite rule in plugin: with .htaccess in plugin folder or using WordPress functions
- Removing rules from .htaccess
- Mapping multiple URLs to same page
- Rewrite Point Doesn’t Work on Custom Taxonomy
- Rewrite url for existing page without flush_rewrite_rules
- Set a specific page as 404 – not found via my own plugin
- URL rewriting must be activated manually for my plugin
- How to change the URL pattern for single post view
- Why doesn’t flush_rewrite_rules run on plugin activation?
- Redirect traffic to plugin
- Append country to ‘pretty’ url but serve same page
- How To Consistently Enforce Rewrite Rule in Plugin Development
- Show custom data instead of 404
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- Adding rewrite rule dynamically
- rewrite URL based on selected taxonomy for post page
- Set a CPT slug as a base name for all the taxonomies
- Remove custom post type slug from URL and add taxonomy Slug
- Help writing custom function with rewrite endpoint that generates a page from dynamic content
- Possible to get all posts with my shortcode?
- add_rewrite_rule behaving strangely
- HowTo to add my rewrite rules at the beginning, redirect to the right page and flush the rules on plugin activation?
- Create page (not the post type) dynamically
- How can I add rewrite rules to a class-based plugin?
- configuration of .htaccess for add_rewrite_rule to make sense
- Plugin Development – Get Admin Url (Including cases where wp-admin is not used)
- If $var is empty, return 404.
- Forward an old url rewrite scheme to a new one?
- Form submission to another page returning 404 error [duplicate]
- Rewriting Image URLs from dynamic to original
- Custom Path for a Plugin
- Custom post type change permalink query
- Check current URL is 404 in pre_option_stylesheet filter hook
- Change cannonical URL after changing url with add_rewrite_rule()
- Disabling Yoast, All-in-One, and Rank Math on Certain Pages within a Plugin
- WordPress custom url without using any of the custom tags given
- Scripts/styles not loading on cloned WP Site when logged in
- Using meta_key & meta_value in add_rewrite_rule
- How to force download a plugin generated file?
- How to pass a more variable with page/subpage in Wordprees URL?
- Any way to make Apache’s internal redirect work?
- Rewriting URLs with a query string
- How can I send an id over the url?
- Custom slug in url for CPT and taxonomy
- add_rewrite_rule not working
- Mapping multiple URLs to same page
- Use custom clean URLs for a plug in
- How to Rewrite WordPress URL for a Plugin
- Virtual Page with Registration form
- How to use permalink query to go to specific tabs in posts
- How to Rewrite WordPress URL for a Plugin
- redirect word-press page with page values
- Plugin – Proper way to handle 404 pages?
- URL rewrite parameter lost (add_rewrite_rule)
- Custom rewrite, url path with parameters to a page
- Pretty URLs for dynamically created product and pagination pages
- All Pages and Post are redirecting to 404 Not Found in wordpress
- in_array function Problem
- Best practice for plugin: always detect admin-ajax call?
- custom wp_editor does not save the content in plugin settings
- Plugin Development: Storing and Manipulating Data That Fits JSON in Database
- Adding another field to user table
- How to set a header in wp_safe_remote_get()?
- Data inserted by wpdb insert is different than data pressnt in database.
- How do I force a download in the admin area?
- add_action wp_ajax_ not loading in plugin file WP Network
- get_avatar filter in WordPress 4.4, how to filter properly
- Cleaning a filename after image sideloading a url that contains `%20`
- Proper Prepare Statement for ALTER TABLE and using AFTER
- How to use a WP_Customize_Control outside of the Customizer?
- Why is the form not updating when I select a new sector from the list?
- Multiple page plugin settings
- WordPress Plugin Development- When our plugin functions call?
- How to change a field in database through a submit button or Checkbox? [closed]
- Plugin creation, restricting access to specific roles
- Overwriting a plugin function
- Grandchildtheme (plugin) add header.php (not exist in child theme)
- Get audio metadata on file upload
- Referencing files in JavaScript in WordPress Plugin
- How to Customize Polylang Language Items
- wordpress automatic update does not run
- Submit form to a different PHP file in the same plugin folder
- What might be the reason of Couldn’t fetch mysqli_result on another domain?
- 404 redirect based on url
- How to list all images used on a specific page?
- Create fixed static pages
- Can calling wp_enqueue_style in wp_iframe apply the stylesheet to everything not just the iframe?
- WP Dropdown Categories, display subcategories but not grandchildren categories?
- How to get terms for taxonomy
- Copied files from plugin to theme not working
- How can I allow the user to press enter without creating a new element in the editor?
- How to rewrite URL and get the values?
- wpdb->get_var always returning 0
- A function that will remove HTML and tags from a string?
- Information on plugin adding text when a post, page, or other such is displayed