I'm trying to add a rewrite rule to my Wordpress site in the "Appearance > Theme File Editor > Theme Functions". It doesn't appear to be working.
Does this look correct?
function my_custom_rewrite_function() {
add_rewrite_tag(
'%id%',
'([^/]+)'
);
add_rewrite_rule('^register/([^/]+)/?', 'index.php?pagename=register&id=$matches[1]', 'top');
flush_rewrite_rules(); // I have this here for testing so I don't have to manually do it
}
add_action('init', 'my_custom_rewrite_function', 10, 0);
Is there anything I'm doing wrong?