diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index f77684129a..98a871d241 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -50,12 +50,21 @@ add_filter('admin_head', 'options_permalink_add_js'); $home_path = get_home_path(); $iis7_permalinks = iis7_supports_permalinks(); +$permalink_structure = get_option( 'permalink_structure' ); $prefix = $blog_prefix = ''; if ( ! got_url_rewrite() ) $prefix = '/index.php'; -if ( is_multisite() && !is_subdomain_install() && is_main_site() ) + +/** + * In a subdirectory configuration of multisite, the `/blog` prefix is used by + * default on the main site to avoid collisions with other sites created on that + * 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/' ) ) { $blog_prefix = '/blog'; +} if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { check_admin_referer('update-permalink'); @@ -94,7 +103,6 @@ if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { exit; } -$permalink_structure = get_option( 'permalink_structure' ); $category_base = get_option( 'category_base' ); $tag_base = get_option( 'tag_base' ); $update_required = false; @@ -162,7 +170,7 @@ if ( ! is_multisite() ) {

URLs which have question marks and lots of numbers in them; however, WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A number of tags are available, and here are some examples to get you started.'); ?>