Custom rewrite rule serves content, but returns 404 error code

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 … Read more

Subsites in Multisite installation throwing 404 error on wp-admin in IIS 7

Figured out the issue. It was with the generated “WordPress Rule 6”. It was giving 2 identical regex expressions. Removed the extra regex expression. Also had to remove “WordPress Rule 5”. Renumber the rules and now everything works fine. Here’s the updated web.config: <?xml version=”1.0″ encoding=”UTF-8″?> <configuration> <system.webServer> <rewrite> <rules> <rule name=”WordPress Rule 1″ stopProcessing=”true”> … Read more

Intentionally exceed max_num_pages on main query without getting 404?

On every page load, WordPress executes these functions in their respective order: init(); parse_request($query_args); send_headers(); query_posts(); handle_404(); register_globals(); where the main query is finished after query_posts(). Note that in this point in time, WordPress knows the template AND all the query variables like max_num_pages. In handle_404(), if the main query has any posts, the function … Read more

“Lost password” page triggers 404

Your theme or plugins are most likely modifying the “Lost password” link on your wp-login.php via the lostpassword_url filter. How do I reset the “change password” page to the WP default one? One would need to remove those filters callbacks. Here’s one (untested) suggestion: add_filter( ‘lostpassword_url’, function( $url, $redirect ) { remove_all_filters( ‘lostpassword_url’ ); return … Read more