Posted by jeremy
So the wife asked me to look at her blog and see if I can fix a problem after she installed some plugin called akismet. The problem was that the paging on this page was broke, because the link didn’t actually have the php file, it had the base uri /blog/wp-admin/ and the query string piece ?apage=2 but no file. So a mouse over showed http://domain/blog/wp-admin/?apage=2
After digging a lot, I realized it had nothing to do with the plugin, and it was related to the $_SERVER['REQUEST_URI'] not working right in IIS. More testing outside wordpress showed that $_SERVER['REQUEST_URI'] was completely empty. But in wordpress it seemed to just lack the actual file.
So tracking it down, word press has a functions.php file in the wp-includes that has a add_query_arg() function.
So I made this modification at the beginning of it…
if ( is_array(func_get_arg(0)) ) {
if ( @func_num_args() < 2 || false === @func_get_arg(1) ){
$sourceurl = $_SERVER['SCRIPT_NAME'] . substr($_SERVER['REQUEST_URI'],strpos($_SERVER['REQUEST_URI'],'?'));
$uri = $sourceurl;
}else{
$uri = @func_get_arg(1);
}
} else {
if ( @func_num_args() < 3 || false === @func_get_arg(2) ){
$sourceurl = $_SERVER['SCRIPT_NAME'] . substr($_SERVER['REQUEST_URI'],strpos($_SERVER['REQUEST_URI'],'?'));
$uri = $sourceurl;
}else{
$uri = @func_get_arg(2);
}
}
It seems to work now, so hopefully someone else may find it useful also.