Retrieving Information from the WordPress Codex

While working on the Extended Super Admins plugin for WordPress, I decided to try to pull information out of the WordPress Codex and use it in the plugin. I did a little Googling, but didn’t come up with much.

Then, I decided to look for API information about MediaWiki (the script used to present the WordPress Codex). After a bit more Googling, I discovered that there is, in fact, an API built into MediaWiki installations. The API is the same on the WordPress codex as it is on WikiPedia (and most other MediaWiki installations, I’m sure). Thankfully, much of the documentation is built right into the API file itself, so loading it up in your browser gives you pretty good instructions on how to use it.

The API isn’t perfect, but it’s a lot better and more robust than some other APIs I’ve used in the past.

So, if you’re looking to pull Codex information into your plugin (or even use it on your website), you can use the handy MediaWiki API to do so. Of course, I would recommend against doing so constantly, but pulling the information and caching it for a while would probably work pretty well.

Did you like this post? Get monthly summary of our new tutorials, posts and tips to your inbox!


Developer Resources