diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-admin/options-permalink.php --- a/wp/wp-admin/options-permalink.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-admin/options-permalink.php Fri Sep 05 18:40:08 2025 +0200 @@ -57,14 +57,14 @@ ); $help_sidebar_content = '

' . __( 'For more information:' ) . '

' . - '

' . __( 'Documentation on Permalinks Settings' ) . '

' . - '

' . __( 'Documentation on Using Permalinks' ) . '

'; + '

' . __( 'Documentation on Permalinks Settings' ) . '

' . + '

' . __( 'Documentation on Using Permalinks' ) . '

'; if ( $is_nginx ) { - $help_sidebar_content .= '

' . __( 'Documentation on Nginx configuration.' ) . '

'; + $help_sidebar_content .= '

' . __( 'Documentation on Nginx configuration.' ) . '

'; } -$help_sidebar_content .= '

' . __( 'Support' ) . '

'; +$help_sidebar_content .= '

' . __( 'Support forums' ) . '

'; get_current_screen()->set_help_sidebar( $help_sidebar_content ); unset( $help_sidebar_content ); @@ -73,10 +73,11 @@ $iis7_permalinks = iis7_supports_permalinks(); $permalink_structure = get_option( 'permalink_structure' ); -$prefix = ''; -$blog_prefix = ''; +$index_php_prefix = ''; +$blog_prefix = ''; + if ( ! got_url_rewrite() ) { - $prefix = '/index.php'; + $index_php_prefix = '/index.php'; } /* @@ -85,7 +86,9 @@ * network. If the `permalink_structure` option has been changed to remove this * base prefix, WordPress core can no longer account for the possible collision. */ -if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) { +if ( is_multisite() && ! is_subdomain_install() && is_main_site() + && str_starts_with( $permalink_structure, '/blog/' ) +) { $blog_prefix = '/blog'; } @@ -107,8 +110,9 @@ if ( ! empty( $permalink_structure ) ) { $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); - if ( $prefix && $blog_prefix ) { - $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); + + if ( $index_php_prefix && $blog_prefix ) { + $permalink_structure = $index_php_prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); } else { $permalink_structure = $blog_prefix . $permalink_structure; } @@ -143,15 +147,19 @@ } if ( $iis7_permalinks ) { - if ( ( ! file_exists( $home_path . 'web.config' ) && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) ) { + if ( ( ! file_exists( $home_path . 'web.config' ) + && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) + ) { $writable = true; } else { $writable = false; } -} elseif ( $is_nginx ) { +} elseif ( $is_nginx || $is_caddy ) { $writable = false; } else { - if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) { + if ( ( ! file_exists( $home_path . '.htaccess' ) + && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) + ) { $writable = true; } else { $writable = false; @@ -182,7 +190,7 @@ 'web.config' ); } - } elseif ( ! $is_nginx && $htaccess_update_required && ! $writable ) { + } elseif ( ! $is_nginx && ! $is_caddy && $htaccess_update_required && ! $writable ) { $message = sprintf( /* translators: %s: .htaccess */ __( 'You should update your %s file now.' ), @@ -195,7 +203,7 @@ add_settings_error( 'general', 'settings_updated', $message, 'success' ); } - set_transient( 'settings_errors', get_settings_errors(), 30 ); + set_transient( 'settings_errors', get_settings_errors(), 30 ); // 30 seconds. wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) ); exit; @@ -211,145 +219,231 @@
-

- number of tags are available, and here are some examples to get you started.' ), - __( 'https://wordpress.org/support/article/using-permalinks/' ) - ); - ?> -

+

+number of tags are available, and here are some examples to get you started.' ), + __( 'https://wordpress.org/documentation/article/customize-permalinks/' ) +); +?> +

'', - 1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/', - 2 => $prefix . '/%year%/%monthnum%/%postname%/', - 3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', - 4 => $prefix . '/%postname%/', +$url_base = home_url( $blog_prefix . $index_php_prefix ); + +$default_structures = array( + array( + 'id' => 'plain', + 'label' => __( 'Plain' ), + 'value' => '', + 'example' => home_url( '/?p=123' ), + ), + array( + 'id' => 'day-name', + 'label' => __( 'Day and name' ), + 'value' => $index_php_prefix . '/%year%/%monthnum%/%day%/%postname%/', + 'example' => $url_base . '/' . gmdate( 'Y/m/d' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', + ), + array( + 'id' => 'month-name', + 'label' => __( 'Month and name' ), + 'value' => $index_php_prefix . '/%year%/%monthnum%/%postname%/', + 'example' => $url_base . '/' . gmdate( 'Y/m' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', + ), + array( + 'id' => 'numeric', + 'label' => __( 'Numeric' ), + 'value' => $index_php_prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', + 'example' => $url_base . '/' . _x( 'archives', 'sample permalink base' ) . '/123', + ), + array( + 'id' => 'post-name', + 'label' => __( 'Post name' ), + 'value' => $index_php_prefix . '/%postname%/', + 'example' => $url_base . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', + ), ); + +$default_structure_values = wp_list_pluck( $default_structures, 'value' ); + +$available_tags = array( + /* translators: %s: Permalink structure tag. */ + 'year' => __( '%s (The year of the post, four digits, for example 2004.)' ), + /* translators: %s: Permalink structure tag. */ + 'monthnum' => __( '%s (Month of the year, for example 05.)' ), + /* translators: %s: Permalink structure tag. */ + 'day' => __( '%s (Day of the month, for example 28.)' ), + /* translators: %s: Permalink structure tag. */ + 'hour' => __( '%s (Hour of the day, for example 15.)' ), + /* translators: %s: Permalink structure tag. */ + 'minute' => __( '%s (Minute of the hour, for example 43.)' ), + /* translators: %s: Permalink structure tag. */ + 'second' => __( '%s (Second of the minute, for example 33.)' ), + /* translators: %s: Permalink structure tag. */ + 'post_id' => __( '%s (The unique ID of the post, for example 423.)' ), + /* translators: %s: Permalink structure tag. */ + 'postname' => __( '%s (The sanitized post title (slug).)' ), + /* translators: %s: Permalink structure tag. */ + 'category' => __( '%s (Category slug. Nested sub-categories appear as nested directories in the URL.)' ), + /* translators: %s: Permalink structure tag. */ + 'author' => __( '%s (A sanitized version of the author name.)' ), +); + +/** + * Filters the list of available permalink structure tags on the Permalinks settings page. + * + * @since 4.9.0 + * + * @param string[] $available_tags An array of key => value pairs of available permalink structure tags. + */ +$available_tags = apply_filters( 'available_permalink_structure_tags', $available_tags ); + +/* translators: %s: Permalink structure tag. */ +$tag_added = __( '%s added to permalink structure' ); +/* translators: %s: Permalink structure tag. */ +$tag_removed = __( '%s removed from permalink structure' ); +/* translators: %s: Permalink structure tag. */ +$tag_already_used = __( '%s (already used in permalink structure)' ); ?>

- - - - - - - - - - - - - - - - - - - - - - - -