Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to install Wordpress from command line in Valet

How to install Wordpress from command line in Valet

I use Valet as my local web development environment (PHP, Laravel, Wordpress, ...)

This gist is my own recipe to install Wordpress from the command line to use it with Valet. Maybe this is useful for you too.

Install 'WP-CLI' command line tool

If you don't have installed 'WP-CLI' tool yet, it can be done (in macOS) with:

$ brew install wp-cli

Install Wordpress

First we must to create a new project folder, download Wordpress and uncompress it... with this single command:

$ wp core download --path=MyWordpress

Now we can cding into our MyWordpress new folder and we can see all the Wordpress stuff right here!

$ cd MyWordpress
$ ls
index.php            wp-admin             wp-config.php        wp-links-opml.php    wp-settings.php
license.txt          wp-blog-header.php   wp-content           wp-load.php          wp-signup.php
readme.html          wp-comments-post.php wp-cron.php          wp-login.php         wp-trackback.php
wp-activate.php      wp-config-sample.php wp-includes          wp-mail.php          xmlrpc.php

It's time to setup our database info. As I said above, I'm using Valet, so I setup my user as root and no password:

$ wp core config --dbname=mywordpress --dbuser=root

Next we will create the database:

$ wp db create

And finally we will make the 'famous five minutes Wordpress install' using:

$ wp core install --url=http://mywordpress.app --title="My Wordpress Site" --admin_user=superadmin --admin_password=supersecret --admin_email=me@mydomain.com --skip-email

That is!

BONUS: Install WooCommerce

$ wp plugin install woocommerce
@jasontucker

This comment has been minimized.

Copy link

commented Apr 12, 2018

@notflip

This comment has been minimized.

Copy link

commented Apr 27, 2018

Thanks for this! I had to change the following to get it to work with the latest Valet

  • .app is not .test by default
  • I had to replace localhost with 127.0.0.1 in wp-config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.