Skip to content

Instantly share code, notes, and snippets.

@dawidurbanski
Last active October 4, 2022 19:37
Show Gist options
  • Save dawidurbanski/ad7c4cf5cf72bb901f4630e141608688 to your computer and use it in GitHub Desktop.
Save dawidurbanski/ad7c4cf5cf72bb901f4630e141608688 to your computer and use it in GitHub Desktop.
Install wordpress with wp-cli using Bedrock installation
#!/bin/bash
# webiste info
WP_TITLE=${WP_SITENAME//\"/}
WP_HOME=$WP_HOME
WP_USER=$WP_ADMIN_NAME
WP_PASSWORD=$WP_ADMIN_PASS
WP_EMAIL=$WP_ADMIN_EMAIL
# install
if ! $( wp core is-installed --allow-root --path=/var/www/html/web/wp ); then
# install wordpress
wp core install \
--url=$WP_HOME \
--title="$WP_TITLE" \
--admin_user=$WP_USER \
--admin_password=$WP_PASSWORD \
--admin_email=$WP_EMAIL \
--skip-email \
--allow-root \
--path=/var/www/html/web/wp
# enable all available plugins
wp plugin activate --all
fi
# refresh permalinks
wp rewrite structure '/%postname%/' --hard --allow-root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment