Title: WP_Rewrite::get_year_permastruct
Published: April 25, 2014
Last modified: May 20, 2026

---

# WP_Rewrite::get_year_permastruct(): string|false

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_rewrite/get_year_permastruct/?output_format=md#description)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rewrite/get_year_permastruct/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rewrite/get_year_permastruct/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rewrite/get_year_permastruct/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rewrite/get_year_permastruct/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rewrite/get_year_permastruct/?output_format=md#wp--skip-link--target)

Retrieves the year permalink structure without month and day.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_rewrite/get_year_permastruct/?output_format=md#description)󠁿

Gets the date permalink structure and strips out the month and day permalink structures.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rewrite/get_year_permastruct/?output_format=md#return)󠁿

 string|false Year permalink structure on success, false on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rewrite/get_year_permastruct/?output_format=md#source)󠁿

    ```php
    public function get_year_permastruct() {
    	$structure = $this->get_date_permastruct();

    	if ( empty( $structure ) ) {
    		return false;
    	}

    	$structure = str_replace( '%monthnum%', '', $structure );
    	$structure = str_replace( '%day%', '', $structure );
    	$structure = preg_replace( '#/+#', '/', $structure );

    	return $structure;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-rewrite.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-wp-rewrite.php#L552)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-rewrite.php#L552-L564)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rewrite/get_year_permastruct/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Rewrite::get_date_permastruct()](https://developer.wordpress.org/reference/classes/wp_rewrite/get_date_permastruct/)`wp-includes/class-wp-rewrite.php` |

Retrieves date permalink structure, with year, month, and day.

  |

| Used by | Description | 
| [get_year_link()](https://developer.wordpress.org/reference/functions/get_year_link/)`wp-includes/link-template.php` |

Retrieves the permalink for the year archives.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rewrite/get_year_permastruct/?output_format=md#changelog)󠁿

| Version | Description | 
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rewrite%2Fget_year_permastruct%2F)
before being able to contribute a note or feedback.