Skip to content

Instantly share code, notes, and snippets.

View andrewmclagan's full-sized avatar
:octocat:
Opening The Sauce

(Rew) Andrew McLagan andrewmclagan

:octocat:
Opening The Sauce
  • Atomi
  • Melbourne, Australia
View GitHub Profile
@andrewmclagan
andrewmclagan / is_rest.php
Created September 5, 2019 11:05 — forked from matzeeable/is_rest.php
Checks if the current request is a WP REST API request.
<?php
if ( !function_exists( 'is_rest' ) ) {
/**
* Checks if the current request is a WP REST API request.
*
* Case #1: After WP_REST_Request initialisation
* Case #2: Support "plain" permalink settings
* Case #3: It can happen that WP_Rewrite is not yet initialized,
* so do this (wp-settings.php)
@andrewmclagan
andrewmclagan / sbf_Store.js
Last active November 12, 2015 02:58 — forked from colinf/sbf_Store.js
Base Flux Store class in ES6 ( See http://cl.ly/0J3j3D1k0742 )
import EventEmitter from 'events';
class Store extends EventEmitter {
static CHANGE_EVENT = 'change';
constructor() {
super();
}