Where to store credentials used in a function? [duplicate]

You could store it as variables

$account_id = 'your_account_id';
$password = 'your password';
someFunction($account_id, $password);

Or store it in {$table_prefix}_options table and retrieve it by get_option function

$account_id = get_option('account_id');
$password = get_option('password');
someFunction($account_id, $password);

You could save this values, for example from admin panel, by update_option function.

Second option is better, because you can share your functions.php with others and they will not know your credentials. It is also important, that password shouldn’t be stored as plain text.

tech