WP_Rewrite::get_month_permastruct() WordPress Method

The WP_Rewrite::get_month_permastruct() method is used to retrieve the month permastruct for the current site. This permastruct is used to generate the month-based archives for the site.

WP_Rewrite::get_month_permastruct() #

Retrieves the month permalink structure without day and with year.


Description

Gets the date permalink structure and strips out the day permalink structures. Keeps the year permalink structure.


Top ↑

Return

(string|false) Year/Month permalink structure on success, false on failure.


Top ↑

Source

File: wp-includes/class-wp-rewrite.php

	public function get_month_permastruct() {
		$structure = $this->get_date_permastruct();

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

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

		return $structure;
	}


Top ↑

Changelog

Changelog
VersionDescription
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.