Contextual Links add destination=node to URL - can i restrict that from happening? - stopping delete functionality
The accepted answer is not entirely correct.  When hook_menu_contextual_links_alter() gets to act on the array of contextual links, no destinations have been set yet.

Instead, just a few lines after menu_contextual_links() (and so its alter hook) is called in contextual_pre_render_links(), there is this line adding the destination to the contextual link:

$item['localized_options']['query'] += drupal_get_destination();


If you set a query destination in hook_menu_contextual_links_alter(), the one you set will win.  But if you just want to get rid of the destination so for instance a redirect set in the form can do its thing (including, say, adding a fragment)... removing the destination before it is added here doesn't work.

This being Drupal, however, two lines later another alter hook is called:

drupal_alter('contextual_links_view', $element, $items);


(This is all in contextual module.)

So implement that hook instead.  For a module named example removing the destination from all node edit alter hooks on a given array of content type machine names available with the function example_selected_node_types(), the implementation would look like this:

/**
 * Implements hook_contextual_links_view_alter().
 */
function example_contextual_links_view_alter(&amp;$element, $items) {
  if (isset($element['#element']['#entity_type']) &amp;&amp;
      $element['#element']['#entity_type'] == 'node' &amp;&amp;
      in_array($element['#element']['#bundle'],
               example_selected_node_types()))
  {
    $element['#links']['node-edit']['query'] = array();
  }
}