I have the following rewrite rule

function coaching_apply_rule() {
    add_rewrite_rule('^coaching/apply/', 'index.php?page_id=5156', 'top');
add_action('init', 'coaching_apply_rule');

Reason for the rule is that /coaching/ is an archive page for a custom post type. I would like my /apply/ page to be a child of the archive page so when a user goes to /coaching/apply/ the page at /apply/ loads. I assume I can do this with the rewrite rule above. 5156 is the id of the /apply/ page.

Using the rewrite analyzer plugin I can see my custom rewrite rule and it says it matches the /coaching/apply/url. But when I visit that url, I get a 404 page. Any thoughts as to why this isn't working?

Analyzer Results enter image description here

1 Answer 1


Well this is silly but I figured it out. I removed the last / from the pattern and now it works as expected. Code is now...

add_rewrite_rule('^coaching/apply', 'index.php?page_id=5156', 'top');

Seems weird to me that ^coaching/apply would work but not ^coaching/apply/ esp when entering example.com/coaching/apply/ as the url works.

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.