Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#42453 closed defect (bug) (duplicate)

network_admin_url returns the wrong url for multisite installation

Reported by: drivdigital's profile drivdigital Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords:
Focuses: multisite Cc:

Description

Steps to reproduce.

  1. Install wordpress in it's own folder, eg "wp".
  2. Set up as a multisite
  3. Set the network site to be eg. "wordpress.dev"

table: wp_site

domain: wordpress.dev
path: /

table: wp_blogs

domain: wordpress.dev
path: /

table: ex_options

option_name: "siteurl"
option_value: "http://wordpress.dev/wp/"
option_name: "home"
option_value: "http://wordpress.dev/"
  1. Go to "http://wordpress.dev/wp/wp-admin/plugins.php"
  2. Observe that the menu links correctly use "http://wordpress.dev/wp/wp-admin/...."
  3. Observe that links created using network_admin_url are wrong, eg. "Add new plugin". They link to "http://wordpress.dev/wp-admin/..." (Missing "/wp/").

Change History (3)

#1 @dd32
7 years ago

This is quite possibly correct as-is - although I'll let someone more familiar with Multisite chime in.

Multisite requires URL rewrites for wp-(admin|content|includes) to be setup to route /wp-admin/ but also /sub-blog-name/wp-admin/ requests to /wp/wp-admin/.

#2 @drivdigital
7 years ago

Here is a workaround I made in case anyone needs it:

<?php
add_filter( 'network_admin_url', function( $url ) {
  return str_replace( '/wp-admin/', '/wp/wp-admin/', $url );
} );

#3 @flixos90
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version 4.8.3 deleted

Duplicate of #36507.

Hi @drivdigital, and welcome to Trac. Thanks for opening this ticket! :)

I've opened a similar ticket before, and the consensus so far has been that this is too much of an edge-case to be fixed, and it can easily be fixed in a small plugin. Moreover, this is likely not the only place with URL issues in multisite when WP is in a subdirectory.

Let's continue to discuss there if necessary.

Note: See TracTickets for help on using tickets.