get_year_permastruct example


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. */
Home | Imprint | This part of the site doesn't use cookies.