Skip to content

Instantly share code, notes, and snippets.

@Jakiboy
Created April 4, 2023 20:59
Show Gist options
  • Save Jakiboy/2f971fdfda31c6d25795737175e62efa to your computer and use it in GitHub Desktop.
Save Jakiboy/2f971fdfda31c6d25795737175e62efa to your computer and use it in GitHub Desktop.
WordPress (Tweaks)

WordPress (Tweaks)

⚡ Automation

#!/bin/bash
R='\033[0;31m'
G='\033[0;32m'
B='\033[0;96m'

IP='{ip}'
SITE='{domain}'

DBUSER='{user}'
DBPASSWORD='{password}'
DBNAME='{db}'

WPUSER='{admin}'
WPPASSWORD='{pass}'
WPEMAIL='{email}'
LOCAL='en_US'

echo -e "${G}Add ${SITE} to hosts..."
echo "${IP} ${SITE}" >> /etc/hosts

sleep 1
clear

echo -e "${G}Add ${SITE} Vhost..."
touch "/etc/apache2/sites-available/${SITE}.conf"
echo "<VirtualHost *:80>
  ServerAdmin {user}@${SITE}
  ServerName ${SITE}
  ServerAlias www.${SITE}
  DocumentRoot \"/var/www/html/${SITE}\"
  DirectoryIndex index.php
  <Directory  \"/var/www/html/${SITE}/\">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>" > "/etc/apache2/sites-available/${SITE}.conf"

a2ensite ${SITE}
service apache2 restart

sleep 1
clear

echo -e "${G}Creating ${SITE} database..."
mysql -u root -e "CREATE USER '${DBUSER}'@'localhost' IDENTIFIED BY '${DBPASSWORD}';"
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '${DBUSER}'@'localhost' WITH GRANT OPTION;"
mysql -u root -e "FLUSH PRIVILEGES;"
mysql -u root -e "CREATE DATABASE IF NOT EXISTS ${DBNAME};"

echo -e "${G}Creating ${SITE}..."

mkdir ${SITE}
cd ${SITE}

wp core download --locale=${LOCAL} --skip-content --allow-root
wp config create --dbname=${DBNAME} --dbuser=${DBUSER} --dbpass=${DBPASSWORD} --allow-root --extra-php <<PHP
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);
define('WP_DEBUG_LOG', true);
PHP

wp core install --url=${SITE} --title=Debug --admin_user=${WPUSER} --admin_password=${WPPASSWORD} --admin_email=${WPEMAIL} --skip-email --allow-root

wp theme install twentytwentythree --allow-root
wp theme install generatepress --activate --allow-root

wp plugin install wp-crontrol --activate --allow-root
wp plugin install transients-manager --activate --allow-root
wp plugin install query-monitor --activate --allow-root
wp plugin install debug-bar --activate --allow-root
wp plugin install health-check --activate --allow-root
wp plugin install wp-reset --allow-root

sleep 1
clear

Authors:

  • Jihad Sinnaour - Jakiboy (Initial work)

⭐ Support:

Please give it a Star if you like the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment