I’m using the wp_get_archives
function in WordPress.
<?php $args = array(
'type' => 'monthly',
'limit' => '',
'format' => 'html',
'before' => '',
'after' => '',
'show_post_count' => false,
'echo' => 1,
'order' => 'DESC'
); ?>
<?php wp_get_archives( $args ); ?>
But I want to be able to change the URL – rather than it going to my WordPress installation directory, how can I change it to my own custom URL?
PS: I found on the general-template.php
file starting at line 937
is where this function starts.
I saw that, inside the function
wp_get_archives
, the links are built with the functionget_archives_link()
. There, we find the filter hookget_archives_link
that returns each HTML link for the archives.So, we can manipulate each of this strings and replace stuff:
brasofilo’s solution worked for me, with some minor adjustments.
before:
after: