Change record status: 
Project: 
Introduced in branch: 
12.1.x
Introduced in version: 
12.1.0
Description: 

BatchBuilder::setUrlOptions() and the url_options key of batch_set() are deprecated in drupal:12.1.0. They are removed from drupal:13.0.0.

The Batch API never read the key, so setting it had no effect. Behavior does not change.

To set options on the URLs of a batch, pass a \Drupal\Core\Url that has them to batch_process(). The options of $redirect apply to the redirect after the batch. The options of $url apply to the redirect to the batch page.

Before After
$builder->setUrlOptions(['query' => ['foo' => 'bar']]); (no effect) Remove the call.
batch_set(['operations' => $ops, 'url_options' => [...]]); (no effect) Remove the key.
Options for the redirect after the batch: setUrlOptions(['query' => ['foo' => 'bar']]) (no effect) batch_process(Url::fromRoute('my_module.done', [], ['query' => ['foo' => 'bar']]));
Options for the batch page URL: setUrlOptions(['query' => ['foo' => 'bar']]) (no effect) batch_process($redirect, Url::fromRoute('system.batch_page.html', [], ['query' => ['foo' => 'bar']]));
Impacts: 
Module developers
Site templates, recipes and distribution developers