Advertisements

get_year_link

Definition:
function get_year_link($year) {}

Retrieve the permalink for the year archives.

Parameters

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

	}

}

1913

Advertisements

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:

WordPress.com Logo

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

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: