WP_Rewrite::get_month_permastruct()publicWP 1.5.0

Retrieves the month permalink structure without day and with year.

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

Метод класса: WP_Rewrite{}

Хуков нет.

Возвращает

Строку|false. Year/Month permalink structure on success, false on failure.

Использование

global $wp_rewrite;
$wp_rewrite->get_month_permastruct();

Список изменений

С версии 1.5.0 Введена.

Код WP_Rewrite::get_month_permastruct() WP 6.6

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;
}