Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MilenFrom/59831d2024e500824cdda8455a012928 to your computer and use it in GitHub Desktop.
Save MilenFrom/59831d2024e500824cdda8455a012928 to your computer and use it in GitHub Desktop.
WP-CLI Default Site Settings
# WP Config Settings
wp config set AUTOMATIC_UPDATER_DISABLED true
wp config set CORE_UPGRADE_SKIP_NEW_BUNDLED true
# Changing Site URL to https
wp option get siteurl | sed "s/http:/https:/g" | xargs -I {} wp option update siteurl {}
wp option get home | sed "s/http:/https:/g" | xargs -I {} wp option update home {}
# Install themes & plugins
wp theme delete twentytwentytwo twentytwentythree
# Timezone and Date Settings
wp option update timezone_string "America/New_York"
wp option update start_of_week 0
# Configure Default Pages
wp post delete $(wp post list --post_type='post' --name=hello-world --format=ids) --force
wp post delete $(wp post list --post_type='page' --name=sample-page --format=ids) --force
wp post create --post_type=page --post_status=publish --post_title="Home"
wp post create --post_type=page --post_status=publish --post_title="Articles"
wp term update category 1 --name=General --slug=general
# Reading Settings
wp option update show_on_front page
wp option update page_on_front $(wp post list --post_type='page' --name=home --format=ids)
wp option update page_for_posts $(wp post list --post_type='page' --name=articles --format=ids)
wp option update rss_use_excerpt 1
wp option update blog_public 0
# Discussion Settings
wp option update default_pingback_flag 0
wp option update default_ping_status closed
wp option update default_comment_status closed
wp option update comment_registration 1
wp option update comment_moderation 1
wp option update show_avatars 0
# Install WP Importer and Import Theme Unit Test Data
wp plugin install wordpress-importer --activate
curl -O https://raw.githubusercontent.com/WPTT/theme-unit-test/master/themeunittestdata.wordpress.xml
wp import ./themeunittestdata.wordpress.xml --authors=create
rm ./themeunittestdata.wordpress.xml
wp plugin deactivate wordpress-importer --uninstall
# Change Front Page and Posts pages for Theme Unit Test Data and delete the placeholders
wp option update page_on_front $(wp post list --post_type='page' --name=front-page --format=ids)
wp option update page_for_posts $(wp post list --post_type='page' --name=blog --format=ids)
# Delete our old default post and page
wp post delete $(wp post list --post_type='page' --name=home --format=ids) --force
wp post delete $(wp post list --post_type='page' --name=articles --format=ids) --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment