How to use if($wp_query->query_vars[‘name’] == ‘pagethatdontexist’) without getting a 404? How to suppress 404
You can use an earlier action, request, to do whatever you need. It allows you to modify query variables, or even cancel the entire request without issuing a 404 error: function wpse112929_cancel_request_parsing( $query_vars ) { if ( in_array( ‘pagethatdontexist’, $query_vars ) ) { return array(); } return $query_vars; } add_action( ‘request’, ‘wpse112929_cancel_request_parsing’ ); I used … Read more