Opened 4 years ago
Last modified 7 months ago
#10970 new enhancement
Remove 'siteurl' setting from options-general.php
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Administration | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | scribu@…, mike.schroder@…, ipstenu@…, mdhansen@… |
Description
From #10957:
azaozz:
Better to fix the cause for this: "WordPress address" (siteurl) shouldn't be changeable from Settings->General at all as it cannot be set safely there. Most users would just break their blogs if they change it.
It is set at install and only needs changing when WordPress is moved to another domain or (sub)directory. This happens very rarely and there are other (better?) ways to set siteurl.
Denis-de-Bernardy:
in this case, we need to make sure the www. pref is passed on to the site_url. else we're bound to get massive bugs (e.g. #9873)
Attachments (4)
Change History (31)
comment:2
hakre
— 4 years ago
Related: #10957 (Use the RELOCATE constant to fix blogs.)
@k_nitin_: There will be always need for configuration. Configuration means that you actually can control the application which is a very important aspect of using it.
It looks to me that the topic is to find how to deal best with known problems.
comment:3
scribu
— 3 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Future Release to 3.0
comment:6
follow-up:
↓ 8
azaozz
— 3 years ago
The patch looks good but I'm thinking about the UI: do we show the siteurl (not changeable) and do we test for upper case characters in home? Or perhaps can test any new value for home with JS and try to match it to siteurl showing a warning if mismatched because of different case? Can possibly handle the www. matching from JS too.
comment:7
hakre
— 3 years ago
Is there a way to setup this value in setup? Or is this done autmatically?
Related?!: #10447
If this commit comes in, supporters will be glad to have a tool at hand that changes a site's siteurl.
comment:8
in reply to:
↑ 6
scribu
— 3 years ago
Replying to azaozz:
The patch looks good but I'm thinking about the UI: do we show the siteurl (not changeable) and do we test for upper case characters in home? Or perhaps can test any new value for home with JS and try to match it to siteurl showing a warning if mismatched because of different case? Can possibly handle the www. matching from JS too.
We could show it disabled, for reference.
I think the validation should first be done on the PHP level and then we can think about validation on the UI level.
Is there a way to setup this value in setup? Or is this done autmatically?
It's done automatically on setup.
If you really wanted to change it, I think you could do it with a custom install.php.
comment:9
scribu
— 3 years ago
If this commit comes in, supporters will be glad to have a tool at hand that changes a site's siteurl.
You could still use options.php to change it.
comment:10
scribu
— 3 years ago
Marked #11934 as dup of this.
comment:11
scribu
— 3 years ago
- Keywords commit added
10970.3.diff keeps the siteurl field for reference.
comment:12
scribu
— 3 years ago
Regarding siteurl.php:
That check is pretty sweet. The question is: are there any cases where you won't get an error?
If so, are they common enough to warrant the existence of the field?
comment:13
scribu
— 3 years ago
In the IRC, wpmuguru pointed out that a user moving to a different domain could safely change the SITEURL from the admin.
That's fine, but that doesn't happen so often that it has to be part of Core. The same could be said for the 'home' option.
We could remove these two fields and write a plugin with the following options:
- www preference
- make homepage be different from the directory you installed WordPress
Also, as said before, advanced users can edit the options directly by going to wp-admin/options.php
comment:14
dd32
— 3 years ago
IMO, The fields need to stay as part of Core, Its a core setting which the user may need to change, Whilst it doesnt happen that often to most users, its required often enough to be included.
Theres an ancient ticket somewhere that i wrote that code for, I cant find it now however (And havnt been able to for awhile, all i remember was Matt gave it a +1 i believe)
If anything, I think the fields should be replaced with a wizard, Else, Just some checking and preventing users from setting it to something invalid would suffice.
Also, I think the www. prefix is being forced the wrong way around in that patch, SiteURL should enforce its prefix upon homeurl, not the other way around?
comment:15
scribu
— 3 years ago
Also, I think the www. prefix is being forced the wrong way around in that patch, SiteURL should enforce its prefix upon homeurl, not the other way around?
It's the other way around because in the patch, the homeurl is the only one that can be changed.
comment:16
Denis-de-Bernardy
— 3 years ago
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.
comment:17
scribu
— 3 years ago
- Keywords commit removed
- Milestone changed from 3.0 to Future Release
Guess this isn't ready for 3.0.
comment:18
scribu
— 3 years ago
Similar: #10970
comment:19
mrmist
— 3 years ago
Related #14865, I'd like to see one or t'other, don't mind which :)
comment:20
nacin
— 2 years ago
- Keywords 3.2-early added
We like this for when we re-do the settings API.
This should probably be a wizard or something, and hidden where possible, and validated (see dd32's plugin) otherwise.
comment:21
DH-Shredder
— 13 months ago
- Cc mike.schroder@… added
comment:22
Ipstenu
— 10 months ago
- Cc ipstenu@… added
comment:23
nacin
— 10 months ago
- Keywords 3.2-early removed
- Milestone changed from Future Release to 3.5
comment:24
MikeHansenMe
— 7 months ago
- Cc mdhansen@… added
comment:25
nacin
— 7 months ago
- Milestone changed from 3.5 to Future Release
comment:26
MikeHansenMe
— 7 months ago
I would really like to see this in 3.6. I cannot count how many times I have had clients try to adjust this and break it.
comment:27
Ipstenu
— 7 months ago
Is there any possibility of getting this to work for Multisite as well?
I've been seeing a rash of people changing foo.domain.com to foo.com and wondering why it broke their site.
Shouldn't we add an option to prevent redirecting from WordPress entirely? Some people have a localhost installation and would prefer to share their new development with other developers over a network. Editing the wp-config or changing the configuration setting value is an added inconvenience.