I had asked this question in a different way too, but no one replied there! I guess I should rephrase it here.
My custom post is 'company'. I'm trying to add a custom rewrite rule. When the 'url http://domain..com/company/company-title-slug/replies', is accessed, I want redirect to a custom template(applied to a page named 'replies') with all the comments for this custom post listed. If I add the comment id in the url like this 'url http://domain..com/company/company-title-slug/replies/23', I want to redirect to another page with a custom template applied for displaying a single comment.

This is what I did for accessing the url... 'http://domain.com/replies/reply_id', and it works fine.


Please guide me in the proper direction, having a real hard time with the url rewrite stuff!

Thanks in advance!

2 Answers 2


I haven't tested it, but what about:


Using add_rewrite_rule only is not enough. It only adds a new rewrite rule to WP. But you need to register new query variable (in your situation, it's reply_id) and parse the request to catch that query variable.

Jan Fabry has posted a detailed sample for creating custom rewrite rule, I think it contains all you need.


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.