Definition:
function add_rewrite_rule($regex, $redirect, $after = 'bottom') {}
Add a straight rewrite rule.
Parameters
- string $regex: Regular Expression to match request against.
- string $redirect: Page to redirect to.
- string $after: Optional, default is ‘bottom’. Where to add rule, can also be ‘top’.
Source code
function add_rewrite_rule($regex, $redirect, $after = 'bottom') { global $wp_rewrite; $wp_rewrite->add_rule($regex, $redirect, $after); }
291
add_rewrite_rule and add_rewrite_tag can be a serious pain if you’re implementing a custom plugin. Might try using this method:
http://gabrielharper.com/blog/2012/09/wordpress-custom-urls-for-plugins/
You can then parse the URL yourself and take over with template_redirect.