Modify existing query and change order of posts

Was able to solve this by first registering the custom query var.
https://codex.wordpress.org/Plugin_API/Filter_Reference/query_vars

And then next I used the switch function:

global $wp_query;

switch ( $wp_query->query_vars['filter'] ) {
        case 'random':
            $recipe_args['orderby']  = 'rand';                  
        break;
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)