I am trying to add multiple endpoints in one url like:


But this way the query var lead_id is equal to 1000/product/123455 and not 1000.

When I do it the following way everything goes right:


So I think that I need to add some rewrite rules, so Wordpress understands that lead_id and product_id are 2 query vars.

How I add my endpoints:

function add_lead_management_endpoints() {

    add_rewrite_endpoint( 'lead_id', EP_PAGES );
    add_rewrite_endpoint( 'product_id', EP_PAGES );

add_action( 'init', 'add_lead_management_endpoints' );

1 Answer 1


Not sure of the context for this, is it a custom post type or just a page?

This might be something which you're looking for -

function add_lead_management_endpoints() {

    add_rewrite_tag( '%lead_id%', '([^&]+)' );
    add_rewrite_tag( '%product_id%', '([^&]+)' );
add_action( 'init', 'add_lead_management_endpoints' );

You'll need to flush permalinks for this to take affect (visit settings->permalinks).

  • Did this resolve your problem @Robbert?
    – Elliott
    Apr 14, 2016 at 20:49
  • It did not test i yet, but you asked whether it is a page or post type and I answered page. So does this change anything in your code?
    – Robbert
    Apr 15, 2016 at 9:29
  • The above is setup to work with the page manage-lead
    – Elliott
    Apr 15, 2016 at 11:53

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.