diff --git a/wp-includes/template-functions-links.php b/wp-includes/template-functions-links.php index 66a195b9de..9eec371563 100644 --- a/wp-includes/template-functions-links.php +++ b/wp-includes/template-functions-links.php @@ -377,8 +377,6 @@ function get_pagenum_link($pagenum = 1) { $page_modstring = "page/"; $page_modregex = "page/?"; $permalink = 0; - //$index = 'index.php'; - $index = $_SERVER['SCRIPT_NAME']; $home_root = parse_url(get_settings('home')); $home_root = $home_root['path']; @@ -386,6 +384,10 @@ function get_pagenum_link($pagenum = 1) { $qstr = preg_replace('|^'. $home_root . '|', '', $qstr); $qstr = preg_replace('|^/+|', '', $qstr); + $index = $_SERVER['SCRIPT_NAME']; + $index = preg_replace('|^'. $home_root . '|', '', $index); + $index = preg_replace('|^/+|', '', $index); + // if we already have a QUERY style page string if( stristr( $qstr, $page_querystring ) ) { $replacement = "$page_querystring=$pagenum";