Skip to content

Instantly share code, notes, and snippets.

View pbearne's full-sized avatar

Paul Bearne pbearne

View GitHub Profile
@wpscholar
wpscholar / multisite-migrate.php
Last active September 20, 2017 23:16
WP-CLI script for moving a multi-site instance from one domain to another
<?php
/**
* WP-CLI script for moving a multi-site instance from one domain to another
*
* Example command usage: wp eval-file multisite-migrate.php old-domain.com new-domain.com
* Note: Currently, this script doesn't update all domain references, such as in post content.
* At this time, it is primarily used when creating a local copy of a multi-site instance in
* order to ensure everything will load on a local dev domain.
*/
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/Sites/wp-plugins/$DIR_NAME/$BRANCH
@joelpurra
joelpurra / README.md
Last active October 2, 2015 13:58
AutoCleanCallback: Automatic HTML input field cleaning onkeyup/onchange using jQuery
@scribu
scribu / array_insert.php
Created September 20, 2010 18:53
array_insert()
<?php
/**
* Insert an array into another array before/after a certain key
*
* @param array $array The initial array
* @param array $pairs The array to insert
* @param string $key The certain key
* @param string $position Wether to insert the array before or after the key
* @return array