You rewrite rule is quite board and it will, for sure, generates 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?p=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.