Skip to content

Instantly share code, notes, and snippets.

@michalsen
Last active March 27, 2018 16:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michalsen/5da0ed7ebcb696abd04bec2e87e8a842 to your computer and use it in GitHub Desktop.
Save michalsen/5da0ed7ebcb696abd04bec2e87e8a842 to your computer and use it in GitHub Desktop.
Wordpress / Lando Setup

Setup of WP in a lando machine

mkdir YOURSITE
cd YOURSITE

git clone https://github.com/WordPress/WordPress .
lando init --recipe wordpress

.lando.yml (currently only for reference)

name: Site Name
recipe: wordpress
config:
  webroot: .

Start Lando

lando start
copy url

go to url
install site

DB_HOST=database
DB_USER=wordpress
DB_PASSWORD=wordpress
DB_NAME=wordpress
DB_PORT=3306

wp-config.php

define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'wordpress');
define('DB_HOST', 'database');

// MAY NOT BE REQUIRED TO CHANGE
$table_prefix  = 'wp_';

// DEFINE WP_CONTENT DIRECTORY
define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'].'/<GITHUB REPO>/wp-content');
define('WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/<GITHUB REPO>/wp-content');

// TURN OFF CACHE
define('WP_CACHE', false);      // enable the cache
define('ENABLE_CACHE', false);  // enable the cache

// DEFINE SITE URL
define('WP_HOME', '<Copied URL>');
define('WP_SITEURL', '<Copied URL>');

define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');

Database

lando db-import <dbfile.sql>
lando mysql wordpress
update wp_users set user_pass = md5('changeME!09') where ID = 1; // admin

WP DB SYNC

https://github.com/wp-sync-db/wp-sync-db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment