问题描述
在最近的WordPress更新之后,我有一个朋友的网站无法正常工作,唯一的解决方法是禁用过时的主题。但是,在切换主题时,它删除了附带的视频功能,现在视频(数百个帖子)只是简码。另外,简码表示“ youtube”或“ vimeo”,但具有相同的简码,否则:
[embedvideo id="VIDEOID" website="PLATFORM"]
我认为以下将嵌入文本更改为正确的代码是正确的,但是当我模拟查询时,我遇到了错误。停用功能仅提取了视频ID,因此我将重写短代码的开头和结尾以用正确的html包围ID。如果使用javascript可以更轻松地解决此问题,则可以使用它。
代码:
UPDATE wp_posts SET post_content = REPLACE(post_content,'[embedvideo id="','<iframe src="https://vimeo.com/') WHERE post_content LIKE ‘%website=“vimeo”%’;
UPDATE wp_posts SET post_content = REPLACE(post_content,'" website="vimeo"]','" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe>’) WHERE post_content LIKE ‘%website="vimeo”%’;
UPDATE wp_posts SET post_content = REPLACE(post_content,'<iframe src="https://www.youtube.com/embed/') WHERE post_content LIKE ‘%website="youtube”%’;
UPDATE wp_posts SET post_content = REPLACE(post_content,'" website="youtube"]','" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe>’) WHERE post_content LIKE ‘%website="youtube”%’
错误:
- 意外字符。 (在[附近]
- 结尾的引号“是预期的。(附近)
不确定我在做什么错。 MySQL版本是5.6
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)