I’m using the following code to have dynamic pages
function custom_rewrite_basic() {
add_rewrite_rule('^prefix-(.*)', 'foo/bar/index.php?page=$matces[1]', 'top');
}
add_action('init', 'custom_rewrite_basic');
This catches /prefix-*
pages and serves my index.php
file. For example: /prefix-foo
serves foo/bar/index.php?page=foo
.
If I add a new page with the url /prefix-foo
, I want it to have priority (to serve the content from the database, not from my PHP file).
How can I do that without changing the regex?