Wordpress

learn and experiment with all things WordPress and WordPress VIP (aka Enterprise WordPress)

Running using Docker Compose

# ensure docker is up and running

# start
docker-compose up -d

# admin ui (login: admin/password01)
open http://localhost:8000/wp-admin

# site
open http://localhost:8000

# root rest api routes
curl http://localhost:8000/index.php?rest_route=/ | jq '.'

# rest api routes
curl http://localhost:8000/\?rest_route\=/wp/v2 | jq '.'

# rest api posts example
curl http://localhost:8000/?rest_route=/wp/v2/posts | jq '.'

# stop
docker-compose down

Extending WP REST API | Adding Custom Endpoints | Custom Plugin Example

based on Adding Custom Endpoints

  1. create wp-root/wp-content/plugins/myplugin.php

    if needed, copy to “live” plugins directory

    cp wp-root/wp-content/plugins/myplugin.php html/wp-content/plugins/myplugin.php
    
  2. activate via Admin | Plugins

  3. access custom endpoint http://localhost:8000/index.php?rest_route=/myplugin/v1/author/1


Running using VVV (Varying Vagrant Vagrants)

Setup

  1. install System Requirements
  2. execute Installation steps

Running

root directory path ~/vagrant-local

  1. vagrant up

  2. add VirtualBox port mappings 0.0.0.0:80 -> 80

  3. update /etc/hosts to point to 127.0.0.1

    sudo sed -i.bu 's/192.168.50.4/127.0.0.1/g' /etc/hosts

  4. visit http://vvv.test

Shouldn’t need to do the /etc/hosts and VirtualBox port mapping steps. This is a workaround to deal with an iss where macOS ignores the entries added by the vagrant-hostsupdater plugin in /etc/hosts file.

stopping

  • vagrant halt

    this removes /etc/hosts entries


Changes

Allow logging in to a WP VIP site (e.g. http://WP-VIP-SITE/wp-admin) with admin / password.

changed wpcom_vip_is_restricted_username @ WP-VIP-SITE/public_html/wp-content/mu-plugins/security.php to

function wpcom_vip_is_restricted_username( $username ) {
	// return 'admin' === $username
	// 	|| WPCOM_VIP_MACHINE_USER_LOGIN === $username
	// 	|| WPCOM_VIP_MACHINE_USER_EMAIL === $username;
	return false;
}

Remove VIP_MAINTENANCE_MODE not defined error message showing in wp-admin and site UIs

added the following to WP-VIP-SITE/public_html/wp-content/client-mu-plugins/plugin-loader.php to get rid of VIP_MAINTENANCE_MODE not defined error message showing in wp-admin and site UIs.

define( 'VIP_MAINTENANCE_MODE', false );

Resources