WP_Rewrite::get_year_permastruct() WordPress Method
The WP_Rewrite::get_year_permastruct() method gets the permalink structure for the year archive.
WP_Rewrite::get_year_permastruct() #
Retrieves the year permalink structure without month and day.
Description
Gets the date permalink structure and strips out the month and day permalink structures.
Return
(string|false) Year permalink structure on success, false on failure.
Source
File: wp-includes/class-wp-rewrite.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;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |