Index: wp-includes/rewrite.php
===================================================================
--- wp-includes/rewrite.php	(revision 19735)
+++ wp-includes/rewrite.php	(working copy)
@@ -24,24 +24,31 @@
 /**
  * Add a new tag (like %postname%).
  *
- * Warning: you must call this on init or earlier, otherwise the query var
- * addition stuff won't work.
+ * The $query parameter is optional. If it is omitted you must ensure that
+ * you call this on, or before, the 'init' hook. This is because $query defaults
+ * to "$tagname=", and for this to work a new query var has to be added.
  *
+ * @see WP_Rewrite::add_rewrite_tag()
  * @since 2.1.0
  *
- * @param string $tagname
- * @param string $regex
+ * @param string $tagname Name of the new rewrite tag.
+ * @param string $regex Regular expression to substitute the tag for in rewrite rules.
+ * @param string $query String to append to the rewritten query. Must end in '='. Optional.
  */
-function add_rewrite_tag($tagname, $regex) {
-	//validation
+function add_rewrite_tag( $tagname, $regex, $query = '' ) {
+	// validate the tagname
 	if ( strlen($tagname) < 3 || $tagname[0] != '%' || $tagname[strlen($tagname)-1] != '%' )
 		return;
 
-	$qv = trim($tagname, '%');
+	global $wp_rewrite, $wp;
 
-	global $wp_rewrite, $wp;
-	$wp->add_query_var($qv);
-	$wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '=');
+	if ( empty( $query ) ) {
+		$qv = trim( $tagname, '%' );
+		$wp->add_query_var( $qv );
+		$query = $qv . '=';
+	}
+
+	$wp_rewrite->add_rewrite_tag( $tagname, $regex, $query );
 }
 
 /**
@@ -1137,15 +1144,12 @@
 	}
 
 	/**
-	 * Append or update tag, pattern, and query for replacement.
+	 * Add or update existing rewrite tags (e.g. %postname%).
 	 *
 	 * If the tag already exists, replace the existing pattern and query for
 	 * that tag, otherwise add the new tag, pattern, and query to the end of the
 	 * arrays.
 	 *
-	 * @internal What is the purpose of this function again? Need to finish long
-	 *           description.
-	 *
 	 * @since 1.5.0
 	 * @access public
 	 *
