Need some help with your project? Contact me

How to batch assign taxonomy terms to nodes using Views Bulk Operations

In this article I am going to show you a quick trick that will allow you to assign taxonomy terms to a lot of nodes all at once. For this we will use Views and Views Bulk Operations and will require no coding whatsoever. So let's begin.

First off, make sure you have the 2 modules installed. Drush will quickly take care of that for you if you don't have them yet:

drush dl ctools views vbo && drush en ctools views views_ui vbo

Now, the next thing we need to do is create a View page that displays the content (nodes, users, etc) you'd like to operate on in bulk (in our case, add taxonomy terms to). Make sure it uses fields and for start, the title field will be enough. For filtering, use whatever you need to filter the View to show only the content you want and sorting doesn't really matter.

Next up, add a new field of the type: Bulk operations: Content. This will provide next to the node title a checkbox for you to select that node to be part of the bulk operation.

To configure this field, make sure you check the boxes Modify entity values and Show available tokens followed by selecting the values of which field you'd like changed (in our case the taxonomy term reference field). In the screenshot below, you can see my selection for the Tags field of the Article node (I am going with a node view displaying articles).

Now you can save the View and navigate to its page. In the image below you can see my example. A table formatted view with the checkbox and the Article node title to its right. And the VBO operations above it.

Now, let's say I want to apply a taxonomy term to all these nodes. I can select them all (either manually or using the top-most checkbox dedicated for selecting all rows at once), choose my operation (Modify entity values) and click Execute. And this is then my next screen:

I have an autocomplete widget (like the default Article content type Tags field referencing taxonomy terms) where I can select one or more terms I'd like applied to all those nodes. I also have an option to ensure that existing values do not get overriden, by checking the respective checkbox. And lastly, I have some tokens available to use (because of the Tokens module).

Once I select my terms and press Next, I get an overview of how many nodes are going to be affected by this change (as you can see below). And that's basically it.

One thing to keep in mind here. If you are adding a non already existing taxonomy term, VBO will create that term as many times as the number of nodes being processed. So you'll end up with a bunch of terms with the same title. Probably not something you either expect or want. I therefore recommend you create your term before and then apply it to the content.

Hope this helps!

Some related articles you might enjoy


Nice introduction, encourages me to use views bulk operations more often from now on. Warning about the 'creating term as many times as the number of nodes' very useful. Thank you for sharing.

Thanks. Great article, is there a way to disable the progressbar after vbo executes

You can give "Skip confirmation step", so you wont see the progress bar.


I can do these things thanks to your article.
but I cannot delete the terms from node...

In drupal6 ,the radio button of deleting terms was appeared under the adding checkbox.

Any suggestions?

Thanks, great tutorial! When I run the patch, the URL aliases are automatically regenerated although the checkboxes in the indivdual nodes (Generate automatic URL alias) are unchecked. This changes the URLs of each node, which I don't want. I haven't figured out how to run the patch without automatically regenerating the URL aliases. Any ideas?

If you have automatic alias patterns activated (autopath) then you have to temporarily remove the alias pattern from the settings. Also remove the default pattern so that no pattern applies for the Content Type in question. Thus the URL pattern will remain untouched when applying the patch with VBO

Also it will create dupe terms when tokens are used instead of normal text. I thing token support itself should be removed while assigning term value.

Also I think the default should be to append not overwrite. "Bulk tagging" doesn't seem to imply "delete some of the tags" to me in any way, the first time I tried it without ticking the box the behavior was a surprise. Hope these can get fixed up, I'll probably try to hack on some fixes so I don't have to explain this awkwardness to other admins.

I am just looking for the same for my project work.

I am trying to clear taxonomy terms fields value from multiple node by selecting particular field and leaving blank that field but term values are still present.
do you know how to clear taxonomy term in bulk?

Hi there. For some reason VBO is not taking the changes. Once selected the flied and executed the command, nothing happens. Thoughts on this pls? Thanks for your great work with Drupal. Much appreciated.

Very nice reading.

After migrate a site from Joomla to Drupal 8 i have a big list of term with your tuto it's so easy :)

On drupal 8.8 for change term in node i must have to use Views Bulk Edit module

Thank you very much

Add new comment

You can post comments in Markdown and basic HTML tags.
For code blocks, wrap your code within '~~~'. For example:
$var = 'my variable';