[wp-trac] [WordPress Trac] #27287: siteurl is missing WordPress path when creating a new site

WordPress Trac noreply at wordpress.org
Thu Mar 20 10:10:52 UTC 2014


#27287: siteurl is missing WordPress path when creating a new site
--------------------------------+-----------------------------
 Reporter:  danielbachhuber     |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Future Release
Component:  Networks and Sites  |     Version:
 Severity:  normal              |  Resolution:
 Keywords:  needs-patch         |     Focuses:  multisite
--------------------------------+-----------------------------

Comment (by thewebists):

 I've come across this issue when using Bedrock (and the same would apply
 to Mark Jaquith's Skeleton).

 For those seeing this problem, my quick fix for this is to define a
 CORE_DIR constant in wp-config to specify an optional subdirectory
 location for the core WordPress files. Then I run the following in a mu-
 plugin:

 {{{
 /**
  * Temporary fix for issue #27287 for multisite blogs with WordPress in
 it's own subdirectory
  * for use with projects such as https://github.com/roots/bedrock and
  * https://github.com/markjaquith/WordPress-Skeleton
  *
  * @see https://core.trac.wordpress.org/ticket/27287
  */
 add_action( 'wpmu_new_blog', function( $blog_id ){
         if (defined('SUBDOMAIN_INSTALL') && SUBDOMAIN_INSTALL &&
 defined('CORE_DIR') && !empty(CORE_DIR)) {
                 switch_to_blog($blog_id);
                 $siteurl = untrailingslashit(get_option('siteurl'));
                 if (!(strpos($siteurl, CORE_DIR) + strlen(CORE_DIR) ===
 strlen($siteurl))) {
                         update_option( 'siteurl', $siteurl . '/' .
 CORE_DIR );
                 }
                 restore_current_blog();
         }
 });
 }}}

 If you're seeing this, then you've probably also come across issue #23221.
 See the OP's solution here:
 https://core.trac.wordpress.org/ticket/23221#comment:27

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27287#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list