WP_Rewrite::get_year_permastruct()
Retrieves the year permalink structure without month and day.
Gets the date permalink structure and strips out the month and day permalink structures.
Метод класса: WP_Rewrite{}
Хуков нет.
Возвращает
Строку|false
. Year permalink structure on success, false on failure.
Использование
global $wp_rewrite; $wp_rewrite->get_year_permastruct();
Список изменений
С версии 1.5.0 | Введена. |
Код WP_Rewrite::get_year_permastruct() WP Rewrite::get year permastruct WP 6.8
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; }