wpseek.com
A WordPress-centric search engine for devs and theme authors
get_year_link › WordPress Function
Since1.5.0
Deprecatedn/a
› get_year_link ( $year )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
| Codex: |
Retrieves the permalink for the year archives.
Source
function get_year_link( $year ) {
global $wp_rewrite;
if ( ! $year ) {
$year = current_time( 'Y' );
}
$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 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 );
}