get_year_link( int|bool $year )

Retrieves the permalink for the year archives.


Parameters

$year

(int|bool) (Required) False for current year or year for permalink.


Return

(string) The permalink for the specified year archive.


Source

File: wp-includes/link-template.php

function get_year_link( $year ) {
	global $wp_rewrite;
	if ( !$year )
		$year = gmdate('Y', current_time('timestamp'));
	$yearlink = $wp_rewrite->get_year_permastruct();
	if ( !empty($yearlink) ) {
		$yearlink = str_replace('%year%', $year, $yearlink);
		$yearlink = home_url( user_trailingslashit( $yearlink, 'year' ) );
	} else {
		$yearlink = home_url( '?m=' . $year );
	}

	/**
	 * Filters the year archive permalink.
	 *
	 * @since WP-1.5.0
	 *
	 * @param string $yearlink Permalink for the year archive.
	 * @param int    $year     Year for the archive.
	 */
	return apply_filters( 'year_link', $yearlink, $year );
}


Changelog

Changelog
Version Description
WP-1.5.0 Introduced.