Advanced API resources (WordCamp Mid-Atlantic)

As part of my WordCamp Mid-Atlantic presentation on advanced WordPress APIs, here’s a list of resources for each API I’ve discussed.

Nothing is better than browsing the source. You may also want to try phpxref, which is truly an amazing resource for tracking down how things get executed and called. (This one, based on trunk, is hosted by one of the lead developers, and is updated each night.)

Slides and descriptions of each API are after the jump.

HTTP API: The public facing functions are in wp-includes/http.php. The internals are in wp-includes/class-http.php. Here’s the Codex article.

Filesystem API: The main functions are in wp-admin/includes/file.php. You’ll have to dig into the source here — there’s basically no documentation other than the source for this API. WPFS also uses a series of libraries in wp-admin/includes.

wp_mkdir_p(): Codex article. This function is in wp-includes/functions.php.

download_url() and unzip_file(): Both in wp-admin/includes/file.php. No documentation really exists, but it’s pretty easy to find the arguments here and also any hooks. download_url() leverages the HTTP API, while unzip_file() uses the ZipArchive library with a fallback to PclZip.

media_sideload_image() and wp_handle_sideload() are both in wp-admin/includes/file.php. They utilize the HTTP API internally.

Embeds: Check the Codex article. Also, the Blackbird API is here.

add_feed() is pretty much undocumented. You’ll find it in wp-includes/rewrite.php. This affects the rewrite rules so you’ll need to add these on an activation hook. For more on that, check out the WP_Rewrite Codex article.

Codex articles for activation hooks, deactivation hooks, and uninstall hooks.

http://www.slideshare.net/andrewnacin/advanced-and-hidden-wordpress-apis

Published by

Andrew Nacin

Lead developer of WordPress, living in Washington, D.C. Follow me on Twitter.

21 thoughts on “Advanced API resources (WordCamp Mid-Atlantic)”

  1. This was one of my favorite WordCamp talks ever. I look forward to next week’s php meet-up in Columbia.

    Hopefully we can get you up for a presentation at the WordPress user’s group in Baltimore.

    1. Ugh, and now commenting on myself to say I’m stupid. We didn’t patch wp_handle_sideload, we patched media_handle_sideload (which is quite useful too) and the correct trac ticket is this one.

      /me obviously needs more coffee.

Comments are closed.