diff --git a/src/wp-admin/css/forms.css b/src/wp-admin/css/forms.css index 55585dbfa5..6db6d188a8 100644 --- a/src/wp-admin/css/forms.css +++ b/src/wp-admin/css/forms.css @@ -1085,7 +1085,6 @@ table.form-table td .updated p { .form-table.permalink-structure .structure-selection .row > div { max-width: calc(100% - 24px); - margin-left: 4px; display: inline-flex; flex-direction: column; } diff --git a/src/wp-admin/options-permalink.php b/src/wp-admin/options-permalink.php index d80c551c70..71a654bc4b 100644 --- a/src/wp-admin/options-permalink.php +++ b/src/wp-admin/options-permalink.php @@ -57,8 +57,8 @@ get_current_screen()->add_help_tab( ); $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.' ) . '

'; @@ -73,10 +73,11 @@ $home_path = get_home_path(); $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 @@ if ( ! got_url_rewrite() ) { * 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() + && 0 === strpos( $permalink_structure, '/blog/' ) +) { $blog_prefix = '/blog'; } @@ -107,8 +110,9 @@ if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) 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,7 +147,9 @@ if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) } 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; @@ -151,7 +157,9 @@ if ( $iis7_permalinks ) { } elseif ( $is_nginx ) { $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; @@ -211,172 +219,214 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
-

- 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/support/article/using-permalinks/' ) +); +?> +

'', - 1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/', - 2 => $prefix . '/%year%/%monthnum%/%postname%/', - 3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', - 4 => $prefix . '/%postname%/', + 1 => $index_php_prefix . '/%year%/%monthnum%/%day%/%postname%/', + 2 => $index_php_prefix . '/%year%/%monthnum%/%postname%/', + 3 => $index_php_prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', + 4 => $index_php_prefix . '/%postname%/', ); -$inputs = array( +$url_base = get_option( 'home' ) . $blog_prefix . $index_php_prefix; + +$default_structure_inputs = array( 0 => array( 'id' => 'plain', 'label' => __( 'Plain' ), 'example' => get_option( 'home' ) . '/?p=123', - 'value' => $structures[0], + 'value' => $default_structures[0], ), 1 => array( 'id' => 'day-name', 'label' => __( 'Day and name' ), - 'example' => get_option( 'home' ) . $blog_prefix . $prefix . '/' . gmdate( 'Y' ) . '/' . gmdate( 'm' ) . '/' . gmdate( 'd' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', - 'value' => $structures[1], + 'example' => $url_base . '/' . gmdate( 'Y/m/d' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', + 'value' => $default_structures[1], ), 2 => array( 'id' => 'month-name', 'label' => __( 'Month and name' ), - 'example' => get_option( 'home' ) . $blog_prefix . $prefix . '/' . gmdate( 'Y' ) . '/' . gmdate( 'm' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', - 'value' => $structures[2], + 'example' => $url_base . '/' . gmdate( 'Y/m' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', + 'value' => $default_structures[2], ), 3 => array( 'id' => 'day-numeric', 'label' => __( 'Numeric' ), - 'example' => get_option( 'home' ) . $blog_prefix . $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/123', - 'value' => $structures[3], + 'example' => $url_base . '/' . _x( 'archives', 'sample permalink base' ) . '/123', + 'value' => $default_structures[3], ), 4 => array( 'id' => 'post-name', 'label' => __( 'Post name' ), - 'example' => get_option( 'home' ) . $blog_prefix . $prefix . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', - 'value' => $structures[4], + 'example' => $url_base . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', + 'value' => $default_structures[4], ), ); + +$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_already_used = __( '%s (already used in permalink structure)' ); ?>

- - - - + + + - - +
+
+ +
+ +
    + $explanation ) : ?> +
  • + +
  • + +
+
+ +
+ + + + + +

topics as your category base would make your category links like %s/topics/uncategorized/. If you leave these blank the defaults will be used.' ), get_option( 'home' ) . $blog_prefix . $prefix ); +printf( + /* translators: %s: Placeholder that must come at the start of the URL. */ + __( 'If you like, you may enter custom structures for your category and tag URLs here. For example, using topics as your category base would make your category links like %s/topics/uncategorized/. If you leave these blank the defaults will be used.' ), + $url_base +); ?>

- - + + - - + + @@ -385,13 +435,14 @@ printf( __( 'If you like, you may enter custom structures for your category and
- + + -

+

/<configuration>/<system.webServer>/<rewrite>/<rules>' ); ?> -

-
- -


-
-

+

+
+ +

+
+ +

+
+

web.config' ); ?> -

- -

+

+ +

+ Error: The root directory of your site is not writable, so creating a file automatically was not possible. This is the URL rewrite rule you should have in your %2$s file. Create a new file called %2$s in the root directory of your site. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this code into the %2$s file.' ), + __( 'https://wordpress.org/support/article/changing-file-permissions/' ), + 'web.config', + 'Ctrl + A', + '⌘ + A' + ); + ?> +

+
+ +

+
+ +

+
+

+ web.config' + ); + ?> +

+ + + + +

Error: The root directory of your site is not writable, so creating a file automatically was not possible. This is the URL rewrite rule you should have in your %2$s file. Create a new file called %2$s in the root directory of your site. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this code into the %2$s file.' ), + /* translators: 1: .htaccess, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A */ + __( 'Error: Your %1$s file is not writable, so updating it automatically was not possible. These are the mod_rewrite rules you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all.' ), + '.htaccess', __( 'https://wordpress.org/support/article/changing-file-permissions/' ), - 'web.config', 'Ctrl + A', '⌘ + A' ); ?> -

-
- -


-
-

- web.config' - ); - ?> -

- - - -

- Error: Your %1$s file is not writable, so updating it automatically was not possible. These are the mod_rewrite rules you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all.' ), - '.htaccess', - __( 'https://wordpress.org/support/article/changing-file-permissions/' ), - 'Ctrl + A', - '⌘ + A' - ); - ?> -

-
- -


-
- - - +

+
+ +

+
+ +

+
+ + + - +