Filter hook 'get_archives_link'

in WP Core File wp-includes/general-template.php at line 1953

View Source

get_archives_link

Filter Hook
Description
Filters the archive link content.

Hook Information

File Location wp-includes/general-template.php View on GitHub
Hook Type Filter
Line Number 1953

Hook Parameters

Type Name Description
string $link_html The archive HTML link content.
string $url URL to archive.
string $text Archive text description.
string $format Link format. Can be 'link', 'option', 'html', or custom.
string $before Content to prepend to the description.
string $after Content to append to the description.
bool $selected True if the current page is the selected archive.

Usage Examples

Basic Usage
<?php
// Hook into get_archives_link
add_filter('get_archives_link', 'my_custom_filter', 10, 7);

function my_custom_filter($link_html, $url, $text, $format, $before, $after, $selected) {
    // Your custom filtering logic here
    return $link_html;
}

Source Code Context

wp-includes/general-template.php:1953 - How this hook is used in WordPress core
<?php
1948  	 * @param string $format    Link format. Can be 'link', 'option', 'html', or custom.
1949  	 * @param string $before    Content to prepend to the description.
1950  	 * @param string $after     Content to append to the description.
1951  	 * @param bool   $selected  True if the current page is the selected archive.
1952  	 */
1953  	return apply_filters( 'get_archives_link', $link_html, $url, $text, $format, $before, $after, $selected );
1954  }
1955  
1956  /**
1957   * Displays archive links based on type and format.
1958   *

PHP Documentation

<?php
/**
	 * 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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 7
  • File: wp-includes/general-template.php
Related Hooks

Related hooks will be displayed here in future updates.