Code WordPress

Batch Update Multiple Git Repositories

This is a small shell script I use to batch update all of my git repositories that are children of a particular folder on my filesystem.

First create a single common folder to checkout all of your projects.  We’ll use vc.

mkdir ~/vc; cd ~/vc

Then place the following file inside the folder.

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
for FOLDER in $DIR/*/; do cd $FOLDER; echo "Updating " $FOLDER; git pull; cd $DIR; done
echo 'Done!'
view raw hosted with ❤ by GitHub

Now checkout your repositories into subfolder.

git clone wp-present

You should now end up with a folder ~/vc/wp-present/ and we can test our update script.

sh ~/vc/

The script should traverse all of the subfolders and issue git pull commands in each.


Dallas to San Francisco

Time to get the MR2!

DFW SFO 5 | My new trip on!


Boston to San Francisco

BOS to SFO | My new trip on!

Code WordPress

Use Wildcards with WP_User_Query to Search for WordPress Users

Information about how to use the wildcard user search in WP to properly populate things like JSON arrays for use with autocomplete JS.


* Search for users by name and return a JSON object of matches
* An example method that demonstrates how to use wildcards (*'s) when
* looking up users. This particular example would be used to create
* a new endpoint that would output a JSON array of returned users.
* Something like this would be useful for JS autocomplete queries.
function skw_user_autocomplete( $search_term ) {
// Note the astrisks
$user_query = new WP_User_Query( array(
'search' => '*' . $search_term . '*',
) );
// Get the results from the query, returning the first user
$users = $user_query->get_results();
$user_ids = array();
foreach( $users as $user ) {
$user_ids[] = array(
'ID' => $user->data->ID,
'label' => $user->data->user_login,
'display_name' => $user->data->display_name
header( 'Content-Type: application/x-json' );
echo $json = json_encode( $user_ids );
WordPress WordPress Plugins

BuddyPress Amigos Automáticos está agora disponível em Português!

BuddyPress Automatic Friends  is now available in Portugeuse thanks to Renato Alves!