WordPress at Your Fingertips
function is not described

WP_Rewrite::get_year_permastruct() public WP 1.5.0

Retrieves the year permalink structure without month and day.

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

{} It's a method of the class: WP_Rewrite{}

No Hooks.


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


global $wp_rewrite;


Since 1.5.0 Introduced.

Code of WP_Rewrite::get_year_permastruct() WP 5.7.2

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;