Categories

Tag: WP Rewrite

I just finished my presentation at WordCamp Vancouver 2013 entitled “WP_Rewrite Isn’t As Scary As You Think.” My intent was to reduce the fear surrounding WP_Rewrite in the hope that more developers will be able to leverage the API in their code. I described my talk thusly:

Everyone wants pretty URLs on their sites, and WordPress provides a powerful system to support this. Behind the magic of the Permalinks settings page is WP_Rewrite, an API terrifying to many developers.

Like most of WordPress, the Rewrites system isn’t limited just to internal use, and understanding how the API works lets developers build powerful tools atop the platform. We’ll start by discussing what happens when you set a permalink structure through the dashboard and how WordPress uses that to query for content. We’ll then explore how you can add custom rewrite rules, both with and without an understanding of regular expressions. By the end of this session, you’ll know what actions and filters are available to tweak rewrite rules, how endpoints enhance your code, and how you can leverage this powerful API to deliver a better user experience.

Proposed as a 45-minute presentation, I was offered a shorter slot instead. As such, the talk isn’t as in-depth as I described it, but it still provides a good primer for those unfamiliar with WP_Rewrite.