I have a whole bunch of posts that I need to add a category to (too many to do via Bulk Actions). They all follow a predictable/consistent post title naming structure that could be matched via regex.
My pseudo-code is:
IF post title matches regex "X"
THEN apply Category "Y" (ie to the matching posts)
I was thinking that this is probably something I can run one-time in a custom PHP script?
I found wp_set_post_categories
(link), but not sure how to use it to assign a category to all posts based on the title text pattern... It seems to be made for updating individual posts?
Thanks