WCSF 2011 Voodoo

Rarst asks: what magic turns pretty permalinks into query variables?

The setup:

The magic:

foreach ( $rewrite as $match => $query ) {
	if ( preg_match("#^$match#", $request_match, $matches) ) {
		// Got a match.
		$this->matched_rule = $match;

The real voodoo is in creating the rewrite rules. Example: bbPress

  • register_post_types
  • register_taxonomies
  • add_rewrite_tags
  • generate_rewrite_rules

Exercise: optimize parse_request by restructuring the rules into a tree.

Nacin suggests: wp-hackers Skip Main Query

  • the grand scheme of things (png, blog post)
  • $wp->init()
  • class freshlypressed_wp extends wp
  • wp() calls $wp->main()
  • $wp->main() calls $this->parse_request()
  • $this is a freshlypressed_wp


  • Can’t extend a variable class (class my_wp extends $wp_class)
  • No pluggable inheritance chaining
  • No way for several plugins to cooperatively extend a class

Shape My WordCamp Talk

Now that Jane’s announcement has made it official, I need to prepare for my talk at WordCamp San Francisco. The working title is “Deep Voodoo: How the innermost innards of WordPress work” and the working content is nil.

This is where you come in. As a core contributor or plugin developer, you are aware of areas in WordPress code that scare you. I’ve been there and back again. I’ve digested, debugged and patched some of the most labyrinthine logic. I’ve even written some of the worst of it. On Saturday, August 13, I will try to make sense of it for everyone.

Please take a minute to recall something in the core code of WordPress that really stumps you. Ask me about it. I will try to work all of your comments into my talk, provided that I can’t answer it with a quick reply, a link to the Codex or a Google search.

If this gambit of asking for questions beforehand fails, maybe I’ll just give a tour of my personal favorite fork of WordPress in which every function block is shaped like a pony. (Please don’t let that happen.)

More WordCamp Road Trip Plans

Planning continues: map, calendar.

Through my new couchsurfing.com account I have begun to make lodging arrangements.

I’m planning to lodge and ride for a few days with WordPresser and motorcyclist Brooke Kuhlmann. He plotted a scenic route to cover the 1,300 miles between Colorado City and San Francisco.

Are you interested in joining the road trip to WordCamp? If enough people get involved we might even call it a rally. Cars are welcome, too. :-)