On this page
WP_Rewrite::get_month_permastruct(): string|false
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.
Return
string|false Year/Month permalink structure on success, false on failure.
Source
File: wp-includes/class-wp-rewrite.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Rewrite::get_date_permastruct() wp-includes/class-wp-rewrite.php | Retrieves date permalink structure, with year, month, and day. |
Used By
| Used By | Description |
|---|---|
| get_month_link() wp-includes/link-template.php | Retrieves the permalink for the month archives with year. |
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rewrite/get_month_permastruct