简体   繁体   中英

Setting WordPress siteurl using wp-cli with WAMP virtual host

I have a bash script that I'm using to install WordPress using wp-cli. Everything works fine except for setting the siteurl. The way I'm installing is:

wp core install --url=mysite --title=mysite --admin_user=admin --admin_password=password --admin_email=example@mysite.com

Even though it should be set at install, the siteurl still winds up being 'localhost', which then breaks everything since I'm using WAMP's virtual host. I tried manually updating with

wp option update siteurl mysite

but that just returns 'Success: Value passed for 'siteurl' option is unchanged.' and siteurl stays as localhost. The WP_SITEURL and WP_HOME values aren't even set in wp-config.php after the script runs. If I manually add them, everything works fine, but I really need it done through a script.

I think I've just got it changed :

Try this :

# wp option set siteurl http://192.168.99.100 --allow-root
Success: Updated 'siteurl' option.
# wp option get siteurl --allow-root
http://192.168.99.100
# wp option set home http://192.168.99.100 --allow-root
Success: Updated 'home' option.
# wp option get home --allow-root
http://192.168.99.100

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM