From debef5a64233dcd4b72d311c13f6bdaeba81dd9a Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 7 Aug 2004 18:12:54 +0000 Subject: [PATCH] Fix get_pagenum_link() to work with path info permalinks and permalinks without trailing slashes. Bug 0002040. git-svn-id: https://develop.svn.wordpress.org/trunk@1514 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/template-functions-links.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-includes/template-functions-links.php b/wp-includes/template-functions-links.php index c9c11a6672..e14823d924 100644 --- a/wp-includes/template-functions-links.php +++ b/wp-includes/template-functions-links.php @@ -331,7 +331,13 @@ function get_pagenum_link($pagenum = 1){ // otherwise, it could be rewritten, OR just the default index ... } elseif( '' != get_settings('permalink_structure')) { $permalink = 1; - $qstr = preg_replace('|(.*)/[^/]*|', '$1/', $qstr).$page_modstring.$pagenum; + + // If it's not a path info permalink structure, trim the index. + if ( ! preg_match('#^/*' . get_settings('blogfilename') . '#', get_settings('permalink_structure'))) { + $qstr = preg_replace("#/*" . get_settings('blogfilename') . "/*#", '/', $qstr); + } + + $qstr = trailingslashit($qstr) . $page_modstring . $pagenum; } else { $qstr = get_settings('blogfilename') . $querystring_start.$page_querystring.$querystring_equal.$pagenum; }