The problem is that in theory the following code:
get_pagenum_link(3);
should return the URL for the the third page. Something like this:
https://www.mysite.com/?page=3
or this
https://www.mysite.com/page/3
Depending on your permalink structure.
The function does what it is supposed to do as long as I have “pretty” permalinks enabled. In that case it returns the correct URL for the third page.
The problem only arises when WordPress is setup to use the default permalink structure. “https://www.mysite.com/?page=3”
In this case get_pagenum_link(3); maintains the “?page=” argument of the page you are currently viewing and then appends “?paged=”.
So, for example, if I am on page 6 and I call
get_pagenum_link(3);
instead of getting the URL for page 3. Something like this:
https://www.mysite.com/?page=3
I get this:
https://www.mysite.com/?page=6&paged=3
is it possible to change the pagination of the page from the following link:
xxx.com/page/2/
to:
xxx.com/?paged=2
Is there any possible method?
I know that the function is get_pagenum_link().
But how I can change the function without editing the core?
Thanks
]]>On my site (www.kompaskaag.nl/arrangementen login: kompaskaag / kompaskaag) I have an overview with different activities which visitors can choose from. They can filter on type of activity, number of persons, time and budget. The overview is refreshed with ajax.
Also the pagination is refreshed. But the link change tot /wp-admin/admin-ajax.php. The link is created by de wp_pagenavi() plugin with the (default) wordpress function get_pagenum_link();.
I’ve searched, but havn’t found anyone else with this problem. Does anyone has a suggestion or possible solution?
Thanks in advance!
]]>In summary, if the URL of my MU blog reads https://mydomain.com/myblog the function get_pagenum_link() will return https://mydomain.com/myblog/myblog/page/2
The expected functionality should be to return https://mydomain.com/myblog/page/2
I found this old MU topic covering the same issue here:
https://mu.www.ads-software.com/forums/topic/17294
Anyone else seen this?
]]>I have a new query inside the page.
When I call wp_pagenavi from https://test.com/net/x-page this adress
it creates me page adresses like https://test.com/net/x-page/page2
https://test.com/net/x-page/page3 etc..
I want to change this adress’s to https://test.com/c/yc/page2
https://test.com/c/yc/page3 to prevent dublicate content. to link it (category)
I found that this adress given by get_pagenum_link( $page ) function from wordpress to the wp_pagenavi.
And get_pagenum_link function uses remove_query_arg to obtain this adress.
But this process being before all query.
So how can I change this adress from net/x-page/page2 to /c/yc/page2
If I cannot solve the problem I will redirect net/x-page/page2 page to the /c/yc/page2 but this will not solve my problem because I want to show page’s content in first page.
Are there any solution
https://www.ads-software.com/extend/plugins/wp-pagenavi/
]]>I have a new query inside the page.
When I call wp_pagenavi from https://test.com/net/x-page this adress
it creates me page adresses like https://test.com/net/x-page/page2
https://test.com/net/x-page/page3 etc..
I want to change this adress’s to https://test.com/c/yc/page2
https://test.com/c/yc/page3 to prevent dublicate content. to link it (category)
I found that this adress given by get_pagenum_link( $page ) function from wordpress to the wp_pagenavi.
And get_pagenum_link function uses remove_query_arg to obtain this adress.
But this process being before all query.
So how can I change this adress from net/x-page/page2 to /c/yc/page2
If I cannot solve the problem I will redirect net/x-page/page2 page to the /c/yc/page2 but this will not solve my problem because I want to show page’s content in first page.
Are there any solution
https://www.ads-software.com/extend/plugins/wp-pagenavi/
]]>I have a new query inside the page.
When I call wp_pagenavi from https://test.com/net/x-page this adress
it creates me page adresses like https://test.com/net/x-page/page2
https://test.com/net/x-page/page3 etc..
I want to change this adress’s to https://test.com/c/yc/page2
https://test.com/c/yc/page3 to prevent dublicate content. to link it (category)
I found that this adress given by get_pagenum_link( $page ) function from wordpress to the wp_pagenavi.
And get_pagenum_link function uses remove_query_arg to obtain this adress.
But this process being before all query.
So how can I change this adress from net/x-page/page2 to /c/yc/page2
If I cannot solve the problem I will redirect net/x-page/page2 page to the /c/yc/page2 but this will not solve my problem because I want to show page’s content in first page.
Are there any solution
https://www.ads-software.com/extend/plugins/wp-pagenavi/
]]>https:///domain.com/path/path/index.php?paged=2
With a duplicate directory path in it.
In other words the black magic in get_pagenum_link of the /wp-includes/template-functions-links is buggy.
It’s really amazing how this function tries to derive the proper URL by inspection, but it doesn’t work in my case and I find the code unfathomable.
My wordpress site is https://cefn.com/curiosity/
The domain is virtually hosted by using mod_rewrite to transparently redirect cefn.com requests to a subdirectory called cefn.com. This may explain why the REQUEST_URI call in this function doesn’t work as expected.
However, I’m guessing that this black magic will break for anyone who uses mod_rewrite in the place of virtual hosting, and hence the REQUEST_URI is unexpectedly different from the actual filesystem location, or something.
I can’t use virtual hosting as I don’t have these admin rights on the server.
Everything else seems to work OK, it’s just this black magic code which gets confused.
.htaccess>>>>>>>>
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
# Remove www
RewriteCond %{HTTP_HOST} www.(.*)
RewriteRule ^(.*)$ https://%1/$1 [R=permanent,L]
#Redirect requests for cefn.com host to its own sub-directory
RewriteCond %{HTTP_HOST} (www.)?cefn.com
RewriteCond %{REQUEST_URI} !/cefn.com/.*
RewriteRule ^(.*)$ /cefn.com/$1
#Redirect requests for everyaction.com host to its own sub-directory
RewriteCond %{HTTP_HOST} (www.)?everyaction.com
RewriteCond %{REQUEST_URI} !/everyaction.com/
RewriteRule ^(.*)$ /everyaction.com/$1
get_pagenum_link black magic >>>>>>
function get_pagenum_link($pagenum = 1) {
global $wp_rewrite;
$qstr = $_SERVER['REQUEST_URI'];
$page_querystring = "paged";
$page_modstring = "page/";
$page_modregex = "page/?";
$permalink = 0;
$home_root = parse_url(get_settings('home'));
$home_root = $home_root['path'];
$home_root = trailingslashit($home_root);
$qstr = preg_replace('|^'. $home_root . '|', '', $qstr);
$qstr = preg_replace('|^/+|', '', $qstr);
$index = $_SERVER['PHP_SELF'];
$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";
$qstr = preg_replace("/".$page_querystring."[^d]+d+/", $replacement, $qstr);
// if we already have a mod_rewrite style page string
} elseif ( preg_match( '|'.$page_modregex.'d+|', $qstr ) ){
$permalink = 1;
$qstr = preg_replace('|'.$page_modregex.'d+|',"$page_modstring$pagenum",$qstr);
// if we don't have a page string at all ...
// lets see what sort of URL we have...
} else {
// we need to know the way queries are being written
// if there's a querystring_start (a "?" usually), it's definitely not mod_rewritten
if ( stristr( $qstr, '?' ) ){
// so append the query string (using &, since we already have ?)
$qstr .= '&' . $page_querystring . '=' . $pagenum;
// otherwise, it could be rewritten, OR just the default index ...
} elseif( '' != get_settings('permalink_structure') && ! is_admin()) {
$permalink = 1;
$index = $wp_rewrite->index;
// If it's not a path info permalink structure, trim the index.
if (! $wp_rewrite->using_index_permalinks()) {
$qstr = preg_replace("#/*" . $index . "/*#", '/', $qstr);
} else {
// If using path info style permalinks, make sure the index is in
// the URI.
if (strpos($qstr, $index) === false) {
$qstr = '/' . $index . $qstr;
}
}
$qstr = trailingslashit($qstr) . $page_modstring . $pagenum;
} else {
$qstr = $index . '?' . $page_querystring . '=' . $pagenum;
}
}
$qstr = preg_replace('|^/+|', '', $qstr);
if ($permalink) $qstr = trailingslashit($qstr);
return preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_settings('home') ) . $qstr );
}