Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 16 months ago

#42993 closed enhancement (duplicate)

WordPress Multisite: Allow for different ports

Reported by: blackbam's profile Blackbam Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Networks and Sites Keywords: has-patch
Focuses: multisite Cc:


The WordPress Codex says it is not possible to run WordPress on a different Port than Port 80 or Port 443. In times of Docker and complex development environment setups this is a real pain in the ass. Furthermore there are some common ports like 8080 which are not unusual for a webserver to use.

Please lets get rid of this completely unnecessary restriction on WordPress network installations. The following solutions seems to describe which parts of the Core have to be adapted:

Maybe there are one or to more things which must be changed, in order to get it to work properly.

Attachments (2)

42993.patch (3.1 KB) - added by enrico.sorcinelli 6 years ago.
42993.2.patch (4.0 KB) - added by enrico.sorcinelli 6 years ago.
This patch replace previous one

Download all attachments as: .zip

Change History (8)

#1 @johnbillion
6 years ago

  • Keywords needs-patch added
  • Type changed from enhancement to feature request
  • Version changed from trunk to 3.0

#2 @enrico.sorcinelli
6 years ago

  • Keywords has-patch added; needs-patch removed
  • Type changed from feature request to enhancement

I was opening a similiar ticket for a patch I made for this.

The proposal patch adds allowed_multisite_ports new filter that allows to define differents ports in Multisite installs other than 80 and 443. For example:

add_filter( 'allowed_multisite_ports', function( $ports ) {
	$ports[] = ':8000';
	return $ports;
} );

I thought it was better to explicitly add differents ports instead of allow differents ports by default (or by defining constant like define( MULTISITE_ALLOW_DIFFERENT_PORTS, true )).

PS: Currently I used filter for sanitize_user() (used in wpmu_create_blog()) in order to allow ports in domain string, even if the best way would be to add a sanitize_domain() dedicated function since the first one allows also underscores.

6 years ago

This patch replace previous one

#3 @enrico.sorcinelli
6 years ago

I just updated the patch also in order to maintain ports when editing site info ( Site Address (URL) ).

This ticket was mentioned in Slack in #core-multisite by enrico.sorcinelli. View the logs.

6 years ago

#5 @jeremyfelt
6 years ago

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

Thanks for the ticket @Blackbam and thanks for the patch @enrico.sorcinelli.

I'm going to close this out as a duplicate of #15936. The focus on IPv6 in that ticket is a little different, but goes hand in hand with arbitrary custom port numbers.

That ticket looks old and unfriendly, but I don't think anything is really holding it up more than a lack of activity. Please chime in with comments and patches there!

#6 @ironprogrammer
16 months ago

Per ticket:21077#comment:13, the original dupe reference from comment:5 where custom port support was grouped with IPv6 updates is no longer applicable.

I'm re-linking this as a dupe of #21077, which continues work on custom port support.

Note: See TracTickets for help on using tickets.