最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Applying A Category to Existing Posts Where Page Title Matches Regex

programmeradmin1浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论