This is a bit different from my usual WordPress/PHP posts, but I still wanted to share as a general development exercise and also to hopefully let other people know what I discovered about working with Child’s Play.

Childs Play Logo

I am friends with the couple who runs the Game On Marathon, a 100-hour video gaming marathon which raises money every year for the Child’s Play charity. As part of the festivities when the event is happening, they needed the ability to trigger different giveaways based on when we hit certain milestones in the fundraising effort. There is a C++ script which handles these giveaways, but it needs to be told what dollar amount the event is at and that was game on marathoncurrently being done by hand. Child’s Play has a website widget which displays the info, but there didn’t seem to be a way of easily getting their hands on the donation total at different points in time for the program so they asked if I may be able to help.

At first I tried to scrape the website via remote POST, but that was a bust. Since the Child’s Play widget is driven by a .js script include, none of the generated markup was available in the DOM when you hit the page from a remote script. While looking through the js source, however, I found reference to a JSON API endpoint which looked promising. I had initially tried googling for such a thing, but came up empty, so my guess is that this is an API they possibly only mean to use internally / by their own tools.

Continue reading

The JSON REST API is coming to WordPress Core soon, either with 4.1 or 4.2. And while this is a fantastic addition to the WordPress ecosystem and we’re going to see some really awesome stuff built with it… it’s just not going to be for everyone. Not all sysadmins will want a new API enabled that gives 3rd party developers access to their site’s content in an easily-consumed format.

Disable all the thingsFortunately, just like the XML-RPC protocol, the people behind the JSON REST API have implemented filters which allow one to disable the API if you like. The simple Disable JSON API plugin gives turn-key functionality to anyone who wants to turn off the JSON REST API if it is already running, or proactively prevent it from functioning once it comes with WordPress Core. When all new versions of WordPress start to come with the API enabled by default, you’ll know that your site is going to disable it out of the gate.

As with anything, YMMV and this certainly isn’t for everyone. In fact, this plugin may break your website if your theme or plugins rely on the functionality of the API. Use with caution, feel free to disable if it’s not working for you, and enjoy!

Download the plugin from the WordPress repository now!