[wp-trac] [WordPress Trac] #63091: wp_get_archives() with post_type parameter generates duplicate query parameters in URLs
WordPress Trac
noreply at wordpress.org
Thu Jan 8 06:27:31 UTC 2026
#63091: wp_get_archives() with post_type parameter generates duplicate query
parameters in URLs
---------------------------+------------------------------
Reporter: childsview | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 6.7.2
Severity: normal | Resolution: invalid
Keywords: needs-testing | Focuses:
---------------------------+------------------------------
Changes (by childsview):
* status: new => closed
* resolution: => invalid
Comment:
Hi, thank you for testing and following up on this issue.
I have tested this on WP 6.9 and can confirm that the issue no longer
occurs. After further investigation, I found that this was not a WordPress
core bug, but rather an issue with my custom theme code.
The problem was caused by the following custom filters in my theme:
{{{
add_filter('getarchives_where', 'my_getarchives_where', 10, 2);
function my_getarchives_where($where, $r)
{
global $my_archives_post_type;
if (isset($r['post_type'])) {
$my_archives_post_type = $r['post_type'];
$where = str_replace('\'post\'', '\'' . $r['post_type'] . '\'',
$where);
} else {
$my_archives_post_type = '';
}
return $where;
}
add_filter('get_archives_link', 'my_get_archives_link');
function my_get_archives_link($link_html)
{
global $my_archives_post_type;
$add_link = '';
if ('' != $my_archives_post_type)
$add_link .= '?post_type=' . $my_archives_post_type;
$link_html = preg_replace("/href=\'(.+)\'/", "href='$1" . $add_link .
"'", $link_html);
return $link_html;
}
}}}
This issue can now be closed. Thank you for your assistance.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63091#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list