Make WordPress Core


Ignore:
Timestamp:
10/01/2015 08:38:40 PM (9 years ago)
Author:
jeremyfelt
Message:

MS: Provide better UI when a main site's /blog prefix is changed.

The main site on a new network is forced by default into using /blog as the prefix for its permalink structure. This can be changed easily through the network admin, though the options-permalink.php screen is then unusable to make further changes to the structure.

Now, if /blog/ is not at the beginning of the permalink_structure option, we do not force /blog as a prefix in the UI.

Fixes #12002.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/options-permalink.php

    r34691 r34749  
    5151$home_path = get_home_path();
    5252$iis7_permalinks = iis7_supports_permalinks();
     53$permalink_structure = get_option( 'permalink_structure' );
    5354
    5455$prefix = $blog_prefix = '';
    5556if ( ! got_url_rewrite() )
    5657    $prefix = '/index.php';
    57 if ( is_multisite() && !is_subdomain_install() && is_main_site() )
     58
     59/**
     60 * In a subdirectory configuration of multisite, the `/blog` prefix is used by
     61 * default on the main site to avoid collisions with other sites created on that
     62 * network. If the `permalink_structure` option has been changed to remove this
     63 * base prefix, WordPress core can no longer account for the possible collision.
     64 */
     65if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
    5866    $blog_prefix = '/blog';
     67}
    5968
    6069if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
     
    95104}
    96105
    97 $permalink_structure = get_option( 'permalink_structure' );
    98106$category_base       = get_option( 'category_base' );
    99107$tag_base            = get_option( 'tag_base' );
     
    163171
    164172<?php
    165 if ( is_multisite() && !is_subdomain_install() && is_main_site() ) {
     173if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
    166174    $permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
    167175    $category_base = preg_replace( '|^/?blog|', '', $category_base );
Note: See TracChangeset for help on using the changeset viewer.