Rewrite rules automatically for pages using specific template

I’m using rewrite rules to add an optional parameter to a page. This page uses a specific page template which handles the implementation of an external data source. add_rewrite_rule(‘^page/([0-9]+)/?’, ‘index.php?pagename=page&id=$matches[1]’, ‘top’); When the page is loaded, the template loads an index from the external source or, if an id is given, a specific object. Since…