get_archives_link

The timeline below displays how wordpress function get_archives_link has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Retrieves archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the `<link>` HTML element with the **archives**
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 * @since 5.2.0 Added the `$selected` parameter.
 *
 * @param string $url      URL to archive.
 * @param string $text     Archive text description.
 * @param string $format   Optional. Can be 'link', 'option', 'html', or custom. Default 'html'.
 * @param string $before   Optional. Content to prepend to the description. Default empty.
 * @param string $after    Optional. Content to append to the description. Default empty.
 * @param bool   $selected Optional. Set to true if the current page is the selected archive page.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '', $selected = false)
{
    $text = wptexturize($text);
    $url = esc_url($url);
    $aria_current = $selected ? ' aria-current="page"' : '';
    if ('link' === $format) {
        $link_html = "\t<link rel='archives' title='" . esc_attr($text) . "' href='{$url}' />\n";
    } elseif ('option' === $format) {
        $selected_attr = $selected ? " selected='selected'" : '';
        $link_html = "\t<option value='{$url}'{$selected_attr}>{$before} {$text} {$after}</option>\n";
    } elseif ('html' === $format) {
        $link_html = "\t<li>{$before}<a href='{$url}'{$aria_current}>{$text}</a>{$after}</li>\n";
    } else {
        // Custom.
        $link_html = "\t{$before}<a href='{$url}'{$aria_current}>{$text}</a>{$after}\n";
    }
    /**
     * Filters the archive link content.
     *
     * @since 2.6.0
     * @since 4.5.0 Added the `$url`, `$text`, `$format`, `$before`, and `$after` parameters.
     * @since 5.2.0 Added the `$selected` parameter.
     *
     * @param string $link_html The archive HTML link content.
     * @param string $url       URL to archive.
     * @param string $text      Archive text description.
     * @param string $format    Link format. Can be 'link', 'option', 'html', or custom.
     * @param string $before    Content to prepend to the description.
     * @param string $after     Content to append to the description.
     * @param bool   $selected  True if the current page is the selected archive.
     */
    return apply_filters('get_archives_link', $link_html, $url, $text, $format, $before, $after, $selected);
}

WordPress Version: 5.5

/**
 * Retrieve archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the `<link>` HTML element with the **archives**
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 * @since 5.2.0 Added the `$selected` parameter.
 *
 * @param string $url      URL to archive.
 * @param string $text     Archive text description.
 * @param string $format   Optional. Can be 'link', 'option', 'html', or custom. Default 'html'.
 * @param string $before   Optional. Content to prepend to the description. Default empty.
 * @param string $after    Optional. Content to append to the description. Default empty.
 * @param bool   $selected Optional. Set to true if the current page is the selected archive page.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '', $selected = false)
{
    $text = wptexturize($text);
    $url = esc_url($url);
    $aria_current = $selected ? ' aria-current="page"' : '';
    if ('link' === $format) {
        $link_html = "\t<link rel='archives' title='" . esc_attr($text) . "' href='{$url}' />\n";
    } elseif ('option' === $format) {
        $selected_attr = $selected ? " selected='selected'" : '';
        $link_html = "\t<option value='{$url}'{$selected_attr}>{$before} {$text} {$after}</option>\n";
    } elseif ('html' === $format) {
        $link_html = "\t<li>{$before}<a href='{$url}'{$aria_current}>{$text}</a>{$after}</li>\n";
    } else {
        // Custom.
        $link_html = "\t{$before}<a href='{$url}'{$aria_current}>{$text}</a>{$after}\n";
    }
    /**
     * Filters the archive link content.
     *
     * @since 2.6.0
     * @since 4.5.0 Added the `$url`, `$text`, `$format`, `$before`, and `$after` parameters.
     * @since 5.2.0 Added the `$selected` parameter.
     *
     * @param string $link_html The archive HTML link content.
     * @param string $url       URL to archive.
     * @param string $text      Archive text description.
     * @param string $format    Link format. Can be 'link', 'option', 'html', or custom.
     * @param string $before    Content to prepend to the description.
     * @param string $after     Content to append to the description.
     * @param bool   $selected  True if the current page is the selected archive.
     */
    return apply_filters('get_archives_link', $link_html, $url, $text, $format, $before, $after, $selected);
}

WordPress Version: 5.4

/**
 * Retrieve archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the `<link>` HTML element with the **archives**
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 * @since 5.2.0 Added the `$selected` parameter.
 *
 * @param string $url      URL to archive.
 * @param string $text     Archive text description.
 * @param string $format   Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
 * @param string $before   Optional. Content to prepend to the description. Default empty.
 * @param string $after    Optional. Content to append to the description. Default empty.
 * @param bool   $selected Optional. Set to true if the current page is the selected archive page.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '', $selected = false)
{
    $text = wptexturize($text);
    $url = esc_url($url);
    $aria_current = $selected ? ' aria-current="page"' : '';
    if ('link' === $format) {
        $link_html = "\t<link rel='archives' title='" . esc_attr($text) . "' href='{$url}' />\n";
    } elseif ('option' === $format) {
        $selected_attr = $selected ? " selected='selected'" : '';
        $link_html = "\t<option value='{$url}'{$selected_attr}>{$before} {$text} {$after}</option>\n";
    } elseif ('html' === $format) {
        $link_html = "\t<li>{$before}<a href='{$url}'{$aria_current}>{$text}</a>{$after}</li>\n";
    } else {
        // Custom.
        $link_html = "\t{$before}<a href='{$url}'{$aria_current}>{$text}</a>{$after}\n";
    }
    /**
     * Filters the archive link content.
     *
     * @since 2.6.0
     * @since 4.5.0 Added the `$url`, `$text`, `$format`, `$before`, and `$after` parameters.
     * @since 5.2.0 Added the `$selected` parameter.
     *
     * @param string $link_html The archive HTML link content.
     * @param string $url       URL to archive.
     * @param string $text      Archive text description.
     * @param string $format    Link format. Can be 'link', 'option', 'html', or custom.
     * @param string $before    Content to prepend to the description.
     * @param string $after     Content to append to the description.
     * @param bool   $selected  True if the current page is the selected archive.
     */
    return apply_filters('get_archives_link', $link_html, $url, $text, $format, $before, $after, $selected);
}

WordPress Version: 5.3

/**
 * Retrieve archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the `<link>` HTML element with the **archives**
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 * @since 5.2.0 Added the `$selected` parameter.
 *
 * @param string $url      URL to archive.
 * @param string $text     Archive text description.
 * @param string $format   Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
 * @param string $before   Optional. Content to prepend to the description. Default empty.
 * @param string $after    Optional. Content to append to the description. Default empty.
 * @param bool   $selected Optional. Set to true if the current page is the selected archive page.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '', $selected = false)
{
    $text = wptexturize($text);
    $url = esc_url($url);
    $aria_current = $selected ? ' aria-current="page"' : '';
    if ('link' === $format) {
        $link_html = "\t<link rel='archives' title='" . esc_attr($text) . "' href='{$url}' />\n";
    } elseif ('option' === $format) {
        $selected_attr = $selected ? " selected='selected'" : '';
        $link_html = "\t<option value='{$url}'{$selected_attr}>{$before} {$text} {$after}</option>\n";
    } elseif ('html' === $format) {
        $link_html = "\t<li>{$before}<a href='{$url}'{$aria_current}>{$text}</a>{$after}</li>\n";
    } else {
        // custom
        $link_html = "\t{$before}<a href='{$url}'{$aria_current}>{$text}</a>{$after}\n";
    }
    /**
     * Filters the archive link content.
     *
     * @since 2.6.0
     * @since 4.5.0 Added the `$url`, `$text`, `$format`, `$before`, and `$after` parameters.
     * @since 5.2.0 Added the `$selected` parameter.
     *
     * @param string $link_html The archive HTML link content.
     * @param string $url       URL to archive.
     * @param string $text      Archive text description.
     * @param string $format    Link format. Can be 'link', 'option', 'html', or custom.
     * @param string $before    Content to prepend to the description.
     * @param string $after     Content to append to the description.
     * @param bool   $selected  True if the current page is the selected archive.
     */
    return apply_filters('get_archives_link', $link_html, $url, $text, $format, $before, $after, $selected);
}

WordPress Version: 5.2

/**
 * Retrieve archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the `<link>` HTML element with the **archives**
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 * @since 5.2.0 Added the `$selected` parameter.
 *
 * @param string $url      URL to archive.
 * @param string $text     Archive text description.
 * @param string $format   Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
 * @param string $before   Optional. Content to prepend to the description. Default empty.
 * @param string $after    Optional. Content to append to the description. Default empty.
 * @param bool   $selected Optional. Set to true if the current page is the selected archive page.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '', $selected = false)
{
    $text = wptexturize($text);
    $url = esc_url($url);
    if ('link' == $format) {
        $link_html = "\t<link rel='archives' title='" . esc_attr($text) . "' href='{$url}' />\n";
    } elseif ('option' == $format) {
        $selected_attr = $selected ? " selected='selected'" : '';
        $link_html = "\t<option value='{$url}'{$selected_attr}>{$before} {$text} {$after}</option>\n";
    } elseif ('html' == $format) {
        $link_html = "\t<li>{$before}<a href='{$url}'>{$text}</a>{$after}</li>\n";
    } else {
        // custom
        $link_html = "\t{$before}<a href='{$url}'>{$text}</a>{$after}\n";
    }
    /**
     * Filters the archive link content.
     *
     * @since 2.6.0
     * @since 4.5.0 Added the `$url`, `$text`, `$format`, `$before`, and `$after` parameters.
     * @since 5.2.0 Added the `$selected` parameter.
     *
     * @param string $link_html The archive HTML link content.
     * @param string $url       URL to archive.
     * @param string $text      Archive text description.
     * @param string $format    Link format. Can be 'link', 'option', 'html', or custom.
     * @param string $before    Content to prepend to the description.
     * @param string $after     Content to append to the description.
     * @param bool   $selected  True if the current page is the selected archive.
     */
    return apply_filters('get_archives_link', $link_html, $url, $text, $format, $before, $after, $selected);
}

WordPress Version: 4.6

/**
 * Retrieve archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the `<link>` HTML element with the **archives**
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 *
 * @param string $url    URL to archive.
 * @param string $text   Archive text description.
 * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
 * @param string $before Optional. Content to prepend to the description. Default empty.
 * @param string $after  Optional. Content to append to the description. Default empty.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '')
{
    $text = wptexturize($text);
    $url = esc_url($url);
    if ('link' == $format) {
        $link_html = "\t<link rel='archives' title='" . esc_attr($text) . "' href='{$url}' />\n";
    } elseif ('option' == $format) {
        $link_html = "\t<option value='{$url}'>{$before} {$text} {$after}</option>\n";
    } elseif ('html' == $format) {
        $link_html = "\t<li>{$before}<a href='{$url}'>{$text}</a>{$after}</li>\n";
    } else {
        // custom
        $link_html = "\t{$before}<a href='{$url}'>{$text}</a>{$after}\n";
    }
    /**
     * Filters the archive link content.
     *
     * @since 2.6.0
     * @since 4.5.0 Added the `$url`, `$text`, `$format`, `$before`, and `$after` parameters.
     *
     * @param string $link_html The archive HTML link content.
     * @param string $url       URL to archive.
     * @param string $text      Archive text description.
     * @param string $format    Link format. Can be 'link', 'option', 'html', or custom.
     * @param string $before    Content to prepend to the description.
     * @param string $after     Content to append to the description.
     */
    return apply_filters('get_archives_link', $link_html, $url, $text, $format, $before, $after);
}

WordPress Version: 4.5

/**
 * Retrieve archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the `<link>` HTML element with the **archives**
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 *
 * @param string $url    URL to archive.
 * @param string $text   Archive text description.
 * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
 * @param string $before Optional. Content to prepend to the description. Default empty.
 * @param string $after  Optional. Content to append to the description. Default empty.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '')
{
    $text = wptexturize($text);
    $url = esc_url($url);
    if ('link' == $format) {
        $link_html = "\t<link rel='archives' title='" . esc_attr($text) . "' href='{$url}' />\n";
    } elseif ('option' == $format) {
        $link_html = "\t<option value='{$url}'>{$before} {$text} {$after}</option>\n";
    } elseif ('html' == $format) {
        $link_html = "\t<li>{$before}<a href='{$url}'>{$text}</a>{$after}</li>\n";
    } else {
        // custom
        $link_html = "\t{$before}<a href='{$url}'>{$text}</a>{$after}\n";
    }
    /**
     * Filter the archive link content.
     *
     * @since 2.6.0
     * @since 4.5.0 Added the `$url`, `$text`, `$format`, `$before`, and `$after` parameters.
     *
     * @param string $link_html The archive HTML link content.
     * @param string $url       URL to archive.
     * @param string $text      Archive text description.
     * @param string $format    Link format. Can be 'link', 'option', 'html', or custom.
     * @param string $before    Content to prepend to the description.
     * @param string $after     Content to append to the description.
     */
    return apply_filters('get_archives_link', $link_html, $url, $text, $format, $before, $after);
}

WordPress Version: 4.3

/**
 * Retrieve archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the `<link>` HTML element with the **archives**
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 *
 * @todo Properly document optional arguments as such
 *
 * @param string $url    URL to archive.
 * @param string $text   Archive text description.
 * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
 * @param string $before Optional.
 * @param string $after  Optional.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '')
{
    $text = wptexturize($text);
    $url = esc_url($url);
    if ('link' == $format) {
        $link_html = "\t<link rel='archives' title='" . esc_attr($text) . "' href='{$url}' />\n";
    } elseif ('option' == $format) {
        $link_html = "\t<option value='{$url}'>{$before} {$text} {$after}</option>\n";
    } elseif ('html' == $format) {
        $link_html = "\t<li>{$before}<a href='{$url}'>{$text}</a>{$after}</li>\n";
    } else {
        // custom
        $link_html = "\t{$before}<a href='{$url}'>{$text}</a>{$after}\n";
    }
    /**
     * Filter the archive link content.
     *
     * @since 2.6.0
     *
     * @param string $link_html The archive HTML link content.
     */
    return apply_filters('get_archives_link', $link_html);
}

WordPress Version: 4.1

/**
 * Retrieve archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the `<link>` HTML element with the **archives**
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 *
 * @todo Properly document optional arguments as such
 *
 * @param string $url URL to archive.
 * @param string $text Archive text description.
 * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
 * @param string $before Optional.
 * @param string $after Optional.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '')
{
    $text = wptexturize($text);
    $url = esc_url($url);
    if ('link' == $format) {
        $link_html = "\t<link rel='archives' title='" . esc_attr($text) . "' href='{$url}' />\n";
    } elseif ('option' == $format) {
        $link_html = "\t<option value='{$url}'>{$before} {$text} {$after}</option>\n";
    } elseif ('html' == $format) {
        $link_html = "\t<li>{$before}<a href='{$url}'>{$text}</a>{$after}</li>\n";
    } else {
        // custom
        $link_html = "\t{$before}<a href='{$url}'>{$text}</a>{$after}\n";
    }
    /**
     * Filter the archive link content.
     *
     * @since 2.6.0
     *
     * @param string $link_html The archive HTML link content.
     */
    $link_html = apply_filters('get_archives_link', $link_html);
    return $link_html;
}

WordPress Version: 3.9

/**
 * Retrieve archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the link HTML element with the <em>archives</em>
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 *
 * @param string $url URL to archive.
 * @param string $text Archive text description.
 * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
 * @param string $before Optional.
 * @param string $after Optional.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '')
{
    $text = wptexturize($text);
    $url = esc_url($url);
    if ('link' == $format) {
        $link_html = "\t<link rel='archives' title='" . esc_attr($text) . "' href='{$url}' />\n";
    } elseif ('option' == $format) {
        $link_html = "\t<option value='{$url}'>{$before} {$text} {$after}</option>\n";
    } elseif ('html' == $format) {
        $link_html = "\t<li>{$before}<a href='{$url}'>{$text}</a>{$after}</li>\n";
    } else {
        // custom
        $link_html = "\t{$before}<a href='{$url}'>{$text}</a>{$after}\n";
    }
    /**
     * Filter the archive link content.
     *
     * @since 2.6.0
     *
     * @param string $link_html The archive HTML link content.
     */
    $link_html = apply_filters('get_archives_link', $link_html);
    return $link_html;
}

WordPress Version: 3.7

/**
 * Retrieve archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the link HTML element with the <em>archives</em>
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 *
 * @param string $url URL to archive.
 * @param string $text Archive text description.
 * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
 * @param string $before Optional.
 * @param string $after Optional.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '')
{
    $text = wptexturize($text);
    $url = esc_url($url);
    if ('link' == $format) {
        $link_html = "\t<link rel='archives' title='" . esc_attr($text) . "' href='{$url}' />\n";
    } elseif ('option' == $format) {
        $link_html = "\t<option value='{$url}'>{$before} {$text} {$after}</option>\n";
    } elseif ('html' == $format) {
        $link_html = "\t<li>{$before}<a href='{$url}'>{$text}</a>{$after}</li>\n";
    } else {
        // custom
        $link_html = "\t{$before}<a href='{$url}'>{$text}</a>{$after}\n";
    }
    $link_html = apply_filters('get_archives_link', $link_html);
    return $link_html;
}