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
- Plugin Form Submission Best Practice
- Plugin directory “Last Updated” not changed after initial commit?
- What is the recommended way to create plugin administration forms?
- How Do I Load My Action Earlier Enough?
- How to check WordPress website username and password is correct
- Custom theme sufficient or custom plugin neccessary for this feature set?
- Check spam in custom form – akismet
- get plugin directory url
- WordPress cron running twice
- PHP library that can merge stylesheet with inline style [closed]
- How do I change the initial quantity of a product in woocommerce?
- How to insert data to a database table when the field is not yet created?
- Show special field when correct shipping is chosen
- Custom Taxonomy to dropdown box on adminside wordpress
- wp.template() returns tags in Ajax response
- How to hide or rename “X” and “x-child” references in website source?
- How to build a fool proof AdSense revenue sharing model?
- get author of published post
- How to access all array values from do_action_ref_array()?
- How to register my code as a plugin
- How to get terms for taxonomy
- How to rewrite URL and get the values?
- Listing wordpress users with a search function
- Plugin won’t activate
- dbdelta failing with error: “WordPress database error Table ‘wp_2_myPlugin’ already exists
- Get cat parameter from admin-ajax
- Limit get_next_post to posts from the same author
- how to create a shortcode from a variable in plugin
- Any way, hook to add content right before the “read more” link?
- Error Connecting to Database WHEN Installing WordPress on XAMPP [Tried All the Usual Stuff] (Pics Included)
- Adding body class in author page for custom role
- TinyMCE 4.7.11 – Enable hidden WordPress core plugins? (referencing a wp-includes from plugin.php)
- Enqueue scripts based on site.
- My enqueue admin style function doesn’t work because of ?=ver
- WordPress filter custom posts by multi terms of of a taxonomy
- How can I give access to my plugin sections in admin?
- Making plugin output customizable
- Return all roles, including custom roles
- Load images from CDN and custom features to “Add Media” dialogue
- Saving metabox updates causing fatal error