Tag nodes from a content type with a taxonomy term

Description

Lets assume that you have a bunch of nodes for a content type and you want to tag them all with the same taxonomy term. First, find the term ID of the relevant term. In example, the term ID is 103 and the content type is "contact".

This is an example if an insert ... select statement.

Snippet

INSERT INTO term_node (nid, vid, tid)
SELECT nid, vid, 103 as tid
FROM `node`
WHERE TYPE = 'contact'
AND language = 'en'

Post new comment

The content of this field is kept private and will not be shown publicly.