Filter hook 'year_link'

in WP Core File wp-includes/link-template.php at line 568

View Source

year_link

Filter Hook
Description
Filters the year archive permalink.

Hook Information

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

Hook Parameters

Type Name Description
string $yearlink Permalink for the year archive.
int $year Year for the archive.

Usage Examples

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

function my_custom_filter($yearlink, $year) {
    // Your custom filtering logic here
    return $yearlink;
}

Source Code Context

wp-includes/link-template.php:568 - How this hook is used in WordPress core
<?php
 563  	 * @since 1.5.0
 564  	 *
 565  	 * @param string $yearlink Permalink for the year archive.
 566  	 * @param int    $year     Year for the archive.
 567  	 */
 568  	return apply_filters( 'year_link', $yearlink, $year );
 569  }
 570  
 571  /**
 572   * Retrieves the permalink for the month archives with year.
 573   *

PHP Documentation

<?php
/**
	 * Filters the year archive permalink.
	 *
	 * @since 1.5.0
	 *
	 * @param string $yearlink Permalink for the year archive.
	 * @param int    $year     Year for the archive.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/link-template.php
Related Hooks

Related hooks will be displayed here in future updates.