You can configure it in your DataProvider using sort params like this:
$dataProvider = new ActiveDataProvider([
// ...
'sort' => [
'params' => ['custom_id' => 2]
]
]);
Note that according to this official documentation if you set params explicitly - sort links won't have request's context GET params.
So you if you want your filter to persist you should merge $_GET array with your custom params injected to the link.
The example with merged $_GET:
$contextParams = \Yii::$app->getRequest()->getQueryParams();
$dataProvider = new ActiveDataProvider([
// ...
'sort' => [
'params' => array_merge($contextParams, ['custom_id' => 2])
]
]);