Extra url paths as variable
The correct way to register the rewrite rule and rewrite tag for your case is: function custom_rewrite_rules() { add_rewrite_tag(‘%nights%’, ‘([^&]+)’); add_rewrite_tag(‘%people%’, ‘([^&]+)’); add_rewrite_rule(‘house/(.+)/(.+)/(.+)/?$’, ‘index.php?house=$matches[1]&nights=$matches[2]&people=$matches[3]’, ‘top’); } add_action(‘init’, ‘custom_rewrite_tag’, 10, 0); The code has been tested and works correctly.