查看MySQL通配符。
用于搜索的正确MySQL查询应该是
WHERE tb_posts.post_content LIKE "%example.com%"
您还应该确保只针对已发布的帖子(与nav\\u menu\\u项目、修订版等不同)。通过以下内容扩展您的位置:
AND tb_posts.post_type IN (\'post\',\'page\',*All Posttypes you use additionally*) AND tb_posts.post_status = \'publish\'
因此,您的完整查询应该如下所示(假设您只使用帖子和页面):
UPDATE tb_posts
SET post_status = \'draft\'
WHERE post_content LIKE "%example.com%"
AND post_type IN (\'post\',\'page\')
AND post_status = \'publish\'
快乐的编码!