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.
Related Posts:
- remove “index.php” from permalinks
- How to get pretty URLs with add_query_arg in permalinks
- Creating custom permalink structure for languages
- Getting the Site URL Including the Front Base
- Update URL Snippet to Canonical Permalink URL
- “.#[random-char-string]” being inserted at end of URLs
- URL Rewrite + Page + Custom Post Type = Unusual Redirect
- Pretty Permalinks
- How to create a permalink structure for posts in a specific category
- Remove subfolders from URL
- flexible rewrite ‘ramble’ URLs with WordPress
- Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?
- How to Modify Existing Rewrite Rules?
- custom permalink/shortlink with base62 encoded post ID
- How to reset canonical URLs / fix redirect loop
- Change blog segment of URL
- Force wordpress to display page with same url structure as categories
- How can i have a custom post type with more slugs for each post?
- URL rewriting: removing the site’s basename for a specific category
- mod-rewrite exception? keep #hash in matching urls?
- Remove parent page from url
- Getting back a permalink from custom url
- Bulk append URL (add word to slug)
- Access posts while mod_rewrite is broken
- Can I change the URL structure for a CPT only?
- Multiple Taxonomy Items for Separate URLs
- WordPress keeps removing query var from the URL
- How to construct a dynamic rewrite rule for child pages that passes more than one query var
- Using a template file for a specific custom URL
- Passing parameter through permalink structure
- rebuilding/ rewriting a url to make it SEO friendly
- a way to support totally different url structure
- How to change URL of my pages?
- Custom Permalink Base
- Include language variable in url
- How to get the perfect WordPress, WooCommerce, Custom Post Type pretty permalinks?
- How does WordPress create URLs that Apache knows about?
- Add .html (dot HTML) extension to custom post types
- How does WordPress handle permalinks?
- Make post slug have priority over category slug
- Remove parent slug for child pages
- Change the custom post type permalink
- Image Attachment Url Rewrite
- Change author slug and functionality
- Rewrite url without flushing the database?
- Setting up two separate blogs while using WordPress as a CMS
- Use Regular Expression to get tag from permalink url during wp_rewrite in generate_rewrite_rules
- WordPress Permalinks & Nginx Rewrite Rule Not Working
- How to redirect to correct pages after permalink structure change
- Is there a link parameter that will show me all my published pages?
- Add prefix to page URL based on the page template
- How to remove specific category from URL in WordPress
- Need to add trailing slash to all internal links relative and absolute
- Custom permalink leads to index page
- Get the url of a page template without using the page slug and ID
- WordPress keeps giving me the wrong permalink
- Permalinks 404 error with HTTPS host
- Mirror content based on URL slug
- How to change hierarchical page permalinks to be flat
- Relative v.s. absolute URLs: which ones should I use for cross-domain portability?
- How to rewrite a URL to another rewritten URL without changing the address?
- wordpress how to replace url /bar with foo/bar for custom post type
- How Do I get the author’s page id?
- Permalinks on Windows IIS not working and web.config breaks site – does wordpress not support windows server now, if so how?
- Order custom post type posts by custom field with pretty URL
- Show category name in the post URL only for specific categories
- Exclude single page from permalink rule
- help to remove last trailing slash using add_rewrite_rule
- How are WordPress Page URLs affected by permalink settings?
- Change permalink to attachment
- Problems with permalinks (.htaccess not working)
- Subdomains pointing to a permalink URL
- Remove international characters from slug – Almost done – Bit help
- replicate url permalink after migrating to wordpress
- corrupted URLs – can’t leave starting page
- Add prefix to url, but products not showing in page SHOP
- MySQL-inserted custom taxonomy term lead to 404, flush rewrites doesn’t help
- URL gives 404 error of my subfolder site when i change permalink
- Nested permalink without dummy parent page
- Website URL Permalinks
- How to add a ‘News’ section to specific posts in WordPress
- Add word to permalinks does not transform the urls
- append current user-id to all internal permalinks
- No Ones Been Able to Override my WordPress Rewrite Rule Issue!
- Pagination links for taxonomy archive page 404 error on every page except first
- Change all pages permalinks instead of hierarchical to have id of the page
- Remove/hide a specify category-name from the url
- How can I get .html URL suffixes in permalinks?
- rewrites and custom links in page need help with add_rewrite_rule
- Category-dependent custom permalink
- Imported posts using wrong domain name
- How to create an IIS7 re-write rule for a single category
- Although rewrite engine is on, I get 404 not found on every page
- Customized author slugs not working with get_author_posts_url method
- ?posts_type=xxx not rewritten
- Custom permalink variable on single post
- region selection
- WordPress custom permalinks, pages are now 404
- Creating complex URLs with WordPress permalink structure
- Standard Htaccess directives disappear by themselves