I want to rewrite




This is what I have done so far without any result. I get a 404 error (mysite.com/events/submission/test-event-01). Can anyone suggest the correct rule?

add_action( 'init', 'epl_rewrite');
add_filter( 'query_vars', 'epl_query_vars');
function epl_rewrite()
    add_rewrite_rule('^submission/([^/]*)[/]?', 'index.php?pagename=submission&epl=$matches[1]', 'top');
function epl_query_vars( $query_vars )
    $query_vars[] = 'epl';
    return $query_vars;


  1. Permalinks are re-saved to flush the rewrite rules.
  2. mysite.com/events/submission page is already added.

Thank you in advance.

  • GET variables aren't a part of the pretty permalinks/rewrite rules system, and you don't need to register GET variables as query vars ( not unless you intend to map part of a pretty URL onto it ). If you want people who visit mysite.com/events/submission/test-event-01 to instead see mysite.com/events/submission?epl=test-event-01 then that's not a rewrite, that's a redirect. WP Rewrite rules are for mapping pretty URLs on to ugly URLs of the form index.php?foo=bar, they aren't redirects.
    – Tom J Nowell
    Feb 27, 2022 at 22:51
  • Thank you so much for the clarification. I will keep a note on this. My purpose is now served with get_query_var.
    – sariDon
    Feb 28, 2022 at 5:12

1 Answer 1


Since 'submission' is a child page of 'events', the rewrite rule should include the parent path

add_rewrite_rule('events/([^/]*)/submission/?', 'index.php?pagename=events/submission&epl=$matches[1]', 'top');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.