Skip to content

Instantly share code, notes, and snippets.

View fjarrett's full-sized avatar

Frankie Jarrett fjarrett

View GitHub Profile
@fjarrett
fjarrett / gist:1c4a5917fb180028d710
Last active August 29, 2015 14:11
Custom user registration via AJAX
<?php
/**
* Process user registration via AJAX
*
* A custom user registration process that listens for a
* specific type POST request that will create a new user
* on the blog.
*
* @action wp_ajax_nopriv_fjarrett_user_registration
@fjarrett
fjarrett / gist:4887016fd3f69463ccb5
Created December 18, 2014 02:26
Custom user registration jQuery
/* globals fjarrett */
jQuery( function( $ ) {
$( document ).on( 'click', 'form #submit-registration', function (e) {
$.ajax({
type: 'POST',
url: fjarrett.ajaxurl,
data: {
action: 'fjarrett_user_registration',
registration_token: $( '#registration_token' ).val(),
@fjarrett
fjarrett / gist:be5423e0899895558d75
Last active August 29, 2015 14:13
Delete unwanted Stream Notification Rule post meta from other post types
<?php
function wp_stream_scrub_notification_rule_post_meta() {
$post_types = get_post_types( array(), 'names' );
unset( $post_types['stream_notification'] );
$args = array(
'post_type' => $post_types,
'post_status' => 'any',
@fjarrett
fjarrett / gist:1334474ad5ae7a71ad33
Created March 30, 2015 21:51
onename verification
Verifying that +fjarrett is my openname (Bitcoin username). https://onename.com/fjarrett
@fjarrett
fjarrett / gist:83c2698ea83ca7381ff8
Last active August 29, 2015 14:18
Testing the output of PHP microtime()
<?php
echo '<h1>Current Time</h1>';
$microtime = microtime( true );
printf( '<p><strong>Unix epoch microtime:</strong> %s</p>', $microtime );
printf( '<p><strong>GMT/UTC timezeone:</strong> %s</p>', date( 'Y-m-d H:i:s', $microtime ) );
@fjarrett
fjarrett / Post_Type.php
Last active August 29, 2015 14:24
Register post type helper class
<?php
///////////////////////////////////////////////////////////////////////////////////
// Please use within a namespace, or change this helper class name. //
// Don't forget to properly prefix the apply_filters() calls made throughout. //
// //
// Example usage: //
// //
// new Post_Type( 'book', 'Book', 'Books' ); //
// new Post_Type( 'video', 'Video', 'Videos', array( 'has_archive' => false ) ); //
@fjarrett
fjarrett / wp-bulk-update-core.sh
Last active September 12, 2015 18:51
Update core on every virtual host running WordPress
#!/bin/bash
for DIR in /var/www/*/public_html; do
cd $DIR
if [ -f "wp-config.php" ]; then
echo "cd $DIR"
@fjarrett
fjarrett / wp-bulk-update-themes.sh
Last active September 12, 2015 18:51
Update all themes on every virtual host running WordPress
#!/bin/bash
for DIR in /var/www/*/public_html; do
cd $DIR
if [ -f "wp-config.php" ]; then
echo "cd $DIR"
@fjarrett
fjarrett / wp-bulk-update-plugins.sh
Last active September 12, 2015 18:51
Update all plugins on every virtual host running WordPress
#!/bin/bash
for DIR in /var/www/*/public_html; do
cd $DIR
if [ -f "wp-config.php" ]; then
echo "cd $DIR"
@fjarrett
fjarrett / gist:8cd04bd33e49bbd6e3b7
Last active September 19, 2015 09:04
Force WP JSON REST API endpoints to always be served over HTTPS
<?php
/**
* Force WP JSON REST API endpoints to always be served over HTTPS
*
* @action wp_json_server_before_serve
*
* @return void
*/
function fjarrett_wp_json_force_ssl() {