Is there a way to move tags order programatically or within the database

We’re going to move the tag order of 300 products. The last tag of each of those products will now be the first one. (because of the special treatment of the primary tag). Is there a way to do it faster than by doing it one by one within the admin?

Thanks in advanced

Hi @lmuzquiz :wave: If you want to do this modification on the database layer you’d need to modify
posts_tags table and it’s sort_order column.

Another approach would be to write a script that would query Admin API (maybe to ease the task you can use Admin-API-SDK) and make similar request to currently done when reordering through Admin UI . This approach would make figuring out underlying sort_order value of each tag easier comparing to direct db modifications :wink:

1 Like