add_rewrite_rule() accepts an array of query vars in WordPress 4.4

A small change to add_rewrite_rule() in [34708] means that in the upcoming WordPress 4.4 an array can be passed as the second parameter instead of a query string.


add_rewrite_rule( 'foo/([^/]+)/bar/([^/]+)/?$', 'index.php?post_type=foo&name=$matches[1]&taxonomy=bar&term=$matches[2]' );


add_rewrite_rule( 'foo/([^/]+)/bar/([^/]+)/?$', array(
	'post_type' => 'foo',
	'name'      => '$matches[1]',
	'taxonomy'  => 'bar',
	'term'      => '$matches[2]',
) );

While this isn’t the biggest change in the world, it makes this parameter much easier on the eyes.

(Note that your $matches variables need to remain in single quotes!)