Multiple endpoints in one URL

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_rule(
        'manage-lead/lead_id/([0-9]{1,})/product_id/([0-9]{1,})',
        'index.php?pagename=manage-lead&lead_id=$matches[1]&product_id=$matches[2]',
        'top'
    );

    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).

Leave a Comment