I am writing a plugin for routing the wordpress pages. So in that i am checking for variable is_404. but which is not set in that plugin. but it is set after words. means ultimately it is calling 404 page only. and if i am checking that variable in 404 page then its value is 1. so can any body tell me what should i do so that I can get that variable’s value properly in my plugin? My code is as follows.
function site_router() {
global $route,$wp_query,$window_title;
$bits =explode("/",$_SERVER['REQUEST_URI']);
if ( $wp_query->is_404 ) {
die("test..");
}
}
add_action( 'send_headers', 'site_router');
with the help of above line that variable is being set.