mysql -u myawesomeusername -p
mysql> create database thisismy\_databasename;
mysql> grant all on thisismy\_databasename.\* to 'thisismy\_username' identified by 'ApasswordBetterThanThis';
(copy and run after successfully running wp core config and wp core install)
wp plugin delete akismet hello;
wp theme activate twentytwelve;
wp theme delete twentyfourteen twentythirteen;
wp post delete $(wp post list --post\_type='post' --format=ids);
wp post delete $(wp post list --post\_type='page' --format=ids);
wp widget delete $(wp widget list sidebar-1 --format=ids);
wp option set default\_comment\_status closed;
This assumes you have installed wp-cli and are familiar with the command line. There are many great tutorials out there on wp-cli installation and beginner use. I have simply compiled a list of commands I often use.
wp core download
wp core config --dbname=my\_databasename --dbuser=my\_databaseuser --dbpass=password
wp core install --url=mysite.com --title='Awesome Site' --admin\_user=mydesiredusername1 --admin\_password=changemepass --admin\[email protected]
(Why keep what you don’t use?)
wp plugin delete akismet hello
wp theme delete twentyfourteen twentythirteen
(good for when setting up an new site to quickly delete hello word fluff)
wp post delete $(wp post list --post\_type='post' --format=ids)
(good for when setting up an new site to quickly delete hello word fluff)
wp post delete $(wp post list --post\_type='page' --format=ids)
(sidebar-1 is default for wordpress twentytwelve, twentythriteen and twentyfourteen)
wp widget delete $(wp widget list sidebar-1 --format=ids)
(no my site is not ‘Just another WordPress site’)
wp option update blogdescription "One of a kind epic tagline for my one of a kind epic site"
(must be done before page creation to apply to the new pages)
wp option set default\_comment\_status closed
(Pretty static here…)
wp post create --post\_type=page --post\_status=publish --post\_title='About'
wp post create --post\_type=page --post\_status=publish --post\_title='Home'
wp post create --post\_type=page --post\_status=publish --post\_title='About'
wp post create --post\_type=page --post\_status=publish --post\_title='Contact'
wp post create --post\_type=page --post\_status=publish --post\_title='Home' &&
wp post create --post\_type=page --post\_status=publish --post\_title='About' &&
wp post create --post\_type=page --post\_status=publish --post\_title='Contact'
(We like change…)
wp post create --post\_type=post --post\_status=publish --post\_title='The meaning of life...'
(as shown before)
wp post list
wp post list --post\_type='page'
wp post list --post\_type='customcontenttype'
(Home page ID is 5, Blog page ID is 10)
wp option update page\_on\_front 5
wp option update page\_for\_posts 10
wp option update show\_on\_front page
wp option update siteurl http://mynewurl.com
wp option update home http://mynewurl.com
wp option update permalink\_structure ""
wp rewrite structure '/%postname%/' --hard
Owner
chown -R username target-directory/
Group
chgrp -R servergroupname target-directory/
Directories
find /path/to/your/wordpress/install/ -type d -exec chmod 755 {} ;
Files
find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} ;
On old server
In WordPress directory export the db:
wp export
On new server
Send the file to the new server
scp [email protected]:~/wordpres-directory/my-sql-dump-file-name.sql ~/public/
wp import