I have seen this question, but it seems that the behaviour in my case is even worse.
I have a text field with custom autocomplete which connects to an external service to get terms, and then it creates them if they do not exist in Drupal. Since I am in a early development phase, I am constantly creating and deleting terms. I re-enabled the standard autocomplete widget for a test, and I found that it shows all the terms I had created and deleted! I checked in
taxonomy_term_field_data, and of course they are present there.
The terms were created with the following code:
use Drupal\taxonomy\Entity\Term; [...] Term::create(array( 'vid' => 'my_taxonomy', 'field_codetype' => $codeType, 'field_mycode' => $myCode, 'field_codedate' => $codeDate, 'field_denominazione' => $denominazione, 'name' => $denominazione, ))->save() ;
and were deleted from the admin interface. Maybe I am missing some mandatory field?