I have a function that is called by hook-menu item an is accesible from different subpages of the site. This function does not return any html, it just do some database inserts and should redirect user back where he came from.

Well, it could be easily done by adding url args as a parameters to this function and then use drupal_goto() with those arguments. But I'm wondering if there is any drupal function for this. I was trying drupal_goto(drupal_get_destination()); but it does nothing.

1 Answer 1


Create your link this way:

$link = l('Link title', 'your/menu/path', array('query' => drupal_get_destination));

This will add the destination argument to the link URL.

Then, at the end of your page callback, simply call:


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.