[wp-trac] [WordPress Trac] #10970: Remove 'siteurl' setting from options-general.php

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 1 11:39:38 UTC 2010


#10970: Remove 'siteurl' setting from options-general.php
----------------------------+-----------------------------------------------
 Reporter:  scribu          |       Owner:                  
     Type:  enhancement     |      Status:  new             
 Priority:  normal          |   Milestone:  3.0             
Component:  Administration  |     Version:                  
 Severity:  normal          |    Keywords:  has-patch commit
----------------------------+-----------------------------------------------

Comment(by Denis-de-Bernardy):

 I use this, myself:

 {{{
         function readonly_url() {
                 $home_url = get_option('home');
                 $site_url = get_option('siteurl');

                 $home_www = strpos($home_url, '://www.') !== false;
                 $site_www = strpos($site_url, '://www.') !== false;

                 if ( $home_www != $site_www ) {
                         if ( $home_www )
                                 $site_url = str_replace('://', '://www.',
 $site_url);
                         else
                                 $site_url = str_replace('://www.', '://',
 $site_url);
                         update_option('siteurl', $site_url);
                 }

                 if ( !defined('WP_HOME') )
                         define('WP_HOME', $home_url);
                 if ( !defined('WP_SITEURL') )
                         define('WP_SITEURL', $site_url);
         } # readonly_url()
 }}}

 No-one has broken a site since.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10970#comment:16>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list