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.

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.

  2. Pingback: Great Wordpress Midatlantic Links | WordPress Tips

  3. Pingback: September Meetup: “What I Learned at WordCamp” | DC WordPress related things

  4. Pingback: New York and Philly, here I come | Andrew Nacin

    • 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.

  5. Pingback: Developing for WordPress with Andrew Nacin | Zyrik Labs

  6. Pingback: WordCamp Netherlands | Andrew Nacin

  7. Pingback: WordCamp Mid-Atlantic » Conference » Russell Heimlich

  8. Pingback: Developing for WordPress with Andrew Nacin - webmaster - Dew's Blog

  9. Pingback: How to Write a WordPress Plugin: 12 Essential Guides and Resources - WordPress, Multisite and BuddyPress plugins, themes, news and help – WPMU.org

  10. Pingback: WordPress Hooks Database, Resources and Tutorials for Plugin Developers - Wordpress Arena

  11. Pingback: SFCite | Blog | How to Write a WordPress Plugin: 12 Essential Guides and Resources

  12. Pingback: Script Installation Service

Comments are closed.