You rewrite rule is quite broad and will most likely generate a lot of conflicts. add_action('init', 'dcc_rewrite_tags'); function dcc_rewrite_tags() { add_rewrite_tag('%propref%', '([^&]+)'); } add_action('init', 'dcc_rewrite_rules'); function dcc_rewrite_rules() { add_rewrite_rule('^cottage-details/(.+)/?$','index.php?page_id=2&propref=$matches[1]','top'); } Then you can access to `propref` query var like: $propref = get_query_var( 'propref' ); And remember to flush the rewrite rules; you can do it by going to Settings -> Permalinks and clicking on save button. **Note**: changed `p` query var to `page_id` because, as you said in the comments, you are using a page, not a standard post.