I was wondering if it's possible to upload a list of tags to the database in bulk, and if so, how?

I need to upload a few hundred tags (all years 1901, 1902, 1903 etc...).

The reason I want to do this is because I need to be able to tag images with a specific year, and by clicking on the 'year' tag I should then be shown all images from that year. The problem is the website is a historical-based on so some of the images date back hundreds of years!

I would rather not edit the database without knowing firstly if it's possible, and secondly what I'm doing.

If there are any other solutions I am open to suggestion, however this one seems easiest to me.


There is no import option for the Tags component. This will make a such import directly into the database a tough process, as you will have to take into consideration all the fields of the table for each row. An insert statement for each row would look like this:

INSERT INTO `cpxns_tags` (`id`, `parent_id`, `lft`, `rgt`, `level`, `path`, `title`, `alias`, `note`, `description`, `published`, `checked_out`, `checked_out_time`, `access`, `params`, `metadesc`, `metakey`, `metadata`, `created_user_id`, `created_time`, `created_by_alias`, `modified_user_id`, `modified_time`, `images`, `urls`, `hits`, `language`, `version`, `publish_up`, `publish_down`)
        (4, 1, 3, 4, 1, '1910', '1910', X'31393130', '', '', 1, 0, '0000-00-00 00:00:00', 1, '{\"tag_layout\":\"\",\"tag_link_class\":\"label label-info\",\"image_intro\":\"\",\"float_intro\":\"\",\"image_intro_alt\":\"\",\"image_intro_caption\":\"\",\"image_fulltext\":\"\",\"float_fulltext\":\"\",\"image_fulltext_alt\":\"\",\"image_fulltext_caption\":\"\"}', '', '', '{\"author\":\"\",\"robots\":\"\"}', 441, '2014-09-04 13:17:21', '', 0, '0000-00-00 00:00:00', '', '', 0, '*', 1, '0000-00-00 00:00:00', '0000-00-00 00:00:00');

Which requires a lot of manual writing. In addition, Tags are using the Nested Set Model to build parents-childs associations and this requires a lot of calculations in order to find the right values for the relative fields. Batch processing or re-saving of Tags has not been proved to fix these issues for tags component and ACL manager (3rd party extension) does not deal with it.

So unless there is another script that will deal with all the above and let you batch import a file with tags, then your best chance is to create them manually from the backend, or during content creation.

Those are my first thoughts on this, but maybe someone has another better idea/suggestion...

  • Thank you @FFrewin that's a very detailed explanation I appreciate it. Seems like a lot of manual coding! I may be as fast doing it during content creation as you suggest. I will wait a few days and see if there are any other suggestions or ideas.
    – jonboy
    Sep 5 '14 at 8:20

There is no need to create those tags first. You can create them on the fly as you need them.

You can create tags on the fly in any content editing screen that has a tags field. Start typing the name of a possible tag. Once you get to three letters you will start to see suggested tags that already exist. If you are creating a brand new tag finish typing the name and hit enter and the tag will be created for you when you save.


  • Thanks @fruppel but the reason I wanted to do this in bulk is because I had several hundred tags to create. I know (now) it's possible to create them 'on the fly' but that would have been far too time consuming. Anyway, I have finished now!
    – jonboy
    Sep 16 '15 at 12:20
  • Ok it was just another hint. I thought you might believe that you need to create them first. And I thought typing a 4 digit number for each picture is even faster than to select it from a list.
    – fruppel
    Sep 16 '15 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.