Recently on a Drupal website, I was tasked with adding a taxonomy reference field to a content type. This taxonomy reference field replaced an existing select list. I was also tasked with writing a script to programmatically assign the value of the existing select field to the new taxonomy reference field.
But how do you programmatically set the value for a taxonomy reference field? It should be pretty straightforward and usually is. Most examples you find online use one of these two methods:
In February, I built a WordPress plugin that allows users to browse blogs by choosing a top-level category in one select box and then having whatever top-level category they select populate a second select box with the subcategories of that top-level category. I decided I would re-create that functionality as a Drupal 8 module.
Note: This post was written 3/20/2016 and refers to a block on this site that displayed links to posts on my Drupal 7 site (webmech.biz). Since that Drupal 7 site has now been taken down, the block of Drupal 7 posts discussed below is no longer available. However, the discussion of how I used processed the data from webmech.biz and used AngularJS to display it may still be of interest.