Ticket #10970: 10970.3.diff

File 10970.3.diff, 2.4 KB (added by scribu, 3 years ago)

instead of removing the siteurl field, just disable it

  • wp-admin/options-general.php

     
    6969</tr> 
    7070<tr valign="top"> 
    7171<th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th> 
    72 <td><input name="blogdescription" type="text" id="blogdescription"  value="<?php form_option('blogdescription'); ?>" class="regular-text" /> 
     72<td><input name="blogdescription" type="text" id="blogdescription" value="<?php form_option('blogdescription'); ?>" class="regular-text" /> 
    7373<span class="description"><?php _e('In a few words, explain what this blog is about.') ?></span></td> 
    7474</tr> 
    7575<?php if ( !is_multisite() ) { ?> 
    7676<tr valign="top"> 
    7777<th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th> 
    78 <td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td> 
     78<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" class="regular-text code disabled" disabled="disabled" /> 
     79<span class="description"><?php _e('For reference only'); ?></span></td> 
    7980</tr> 
    8081<tr valign="top"> 
    8182<th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th> 
  • wp-admin/options.php

     
    3737$mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass'); 
    3838 
    3939if ( !is_multisite() ) { 
    40         if ( !defined( 'WP_SITEURL' ) ) $whitelist_options['general'][] = 'siteurl'; 
    4140        if ( !defined( 'WP_HOME' ) ) $whitelist_options['general'][] = 'home'; 
    4241        $whitelist_options['general'][] = 'admin_email'; 
    4342        $whitelist_options['general'][] = 'users_can_register'; 
     
    115114                        $_POST['gmt_offset'] = preg_replace('/UTC\+?/', '', $_POST['gmt_offset']); 
    116115                        $_POST['timezone_string'] = ''; 
    117116                } 
     117 
     118                // Make 'www' preference consistent 
     119                $siteurl = get_option('siteurl'); 
     120                if ( FALSE !== strpos($_POST['home'], '://www.') ) 
     121                        update_option('siteurl', str_replace('://', '://www.', $siteurl)); 
     122                else 
     123                        update_option('siteurl', str_replace('://www.', '://', $siteurl)); 
    118124        } 
    119125 
    120126        if ( $options ) {