How to edit vocabulary machine name?
Suppose that the machine name of your vocabulary is: test.

Then you can use the following code

$vid= 'test';

$vocabulary= taxonomy_vocabulary_load($vid);

$vocabulary-&gt;set('name', trim('newmachinename'));

$vocabulary-&gt;save();



  change the newmachinename by your machine name.


Note. you must be careful when using this code, because those configurations that you have with the previous machine name will be affected