function get_year_link($year) {}

Retrieve the permalink for the year archives.


  • int|bool $year: False for current year or year for permalink.

Defined filters

  • year_link
    apply_filters('year_link', home_url( user_trailingslashit($yearlink, 'year')
  • year_link
    apply_filters('year_link', home_url('?m=' . $year)

Source code

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);

		return apply_filters('year_link', home_url( user_trailingslashit($yearlink, 'year') ), $year);

	} else {

		return apply_filters('year_link', home_url('?m=' . $year), $year);




No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: