Opened 2 years ago
Last modified 2 years ago
#57269 new enhancement
Get site URL from config instead of the database
Reported by: | mhmdyassin07 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Upgrade/Install | Keywords: | close 2nd-opinion |
Focuses: | Cc: |
Description (last modified by )
a big problem is facing everyone trying to move a site between two hosting or between two environments like (staging and production )
the most frequent problem is the site URL and the internal links
and if you have extensive databases it will be your nightmare
so it creates issues and limits our flexibility
so what I suggest is to set the site and home URLs from the wp-config.php file
like
define( 'SITEURL', 'https://mywebsite.com' );
I know it is not very simple, especially with multi-sites but it deserves
I also tried
define( 'WP_HOME', 'http://example.com' ); define( 'WP_SITEURL', 'http://example.com' );
but if you don't have 'siteurl' option on your site it will give you
'Error establishing a database connection' in the front end
and
'One or more database tables are unavailable. The database may need to be repaired.'
which even not the clear error message
die to
wp-includes/functions.php => function is_blog_installed
I can work on this point but before I spend time, I need approval from the WordPress team that they will accept such modification or that not be accepted
Change History (4)
#1
@
2 years ago
- Component changed from Database to Upgrade/Install
- Description modified (diff)
- Focuses performance removed
- Keywords close 2nd-opinion added
- Summary changed from Force WordPress to get it's siteurl from config not from the databes to In multisite, get site URL from config instead of the database
#2
follow-ups:
↓ 3
↓ 4
@
2 years ago
But I need to make it in a normal site not a multisite @sabernhardt
#3
in reply to:
↑ 2
@
2 years ago
- Focuses multisite removed
- Summary changed from In multisite, get site URL from config instead of the database to Get site URL from config instead of the database
Replying to mhmdyassin07:
But I need to make it in a normal site not a multisite
Thanks for the follow-up! Renaming the ticket accordingly.
In that case, this sounds like the issue previously reported in #23487 and #29794.
While the siteurl
database option is indeed required for the is_blog_installed()
function to work, the WP_HOME
and WP_SITEURL
constants do override the respective database options, so it's not quite clear to me what is the exact issue or suggestion here.
For easier migrations or creating a test environment, a snippet like in comment:2:ticket:36737 for replacing internal links in content on the fly might be helpful.
Hi and thanks for the report!
I think this is the same issue as #55607 and very similar to #33909. We probably should close this ticket as a duplicate of one of those.
Changeset [14517] intentionally removed URL filters in multisite to correct the admin URL, and reinstating them probably could break other things now.