After a bit more slogging through code and Googling, I found the answer. It’s contained in this thread (see Otto42’s post), but for the record, adding the following to your plugin will override the 404 handling for the conditions you specify:
1 2 3 4 5 6 7 8 9 10 | function my_404_override() { global $wp_query; if (<some condition is met>) { status_header( 200 ); $wp_query->is_404=false; } } add_filter('template_redirect', 'my_404_override' ); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.