I had used the ZD Video Plugin for WP a long time, and now, since my move to WP 3.0.2, it doesn’t work anymore. To embed a YouTube video using the plugin, I would just write
[zdvideo]url-of-youtube-video[/zdvideo]
Now I need to go back to plain YouTube embedding. How do I write a MySQL query that searches for [zdvideo]*[zdvideo]
and replaces it with *
?
What about these two queries?
Best I’m aware, MySQL doesn’t have much of a regexp replace functionality — not to mention its very clunky regexp syntax. So this is easiest to do at the php level. Start by fetching all posts that have the shortcode:
And then loop through the result:
or use the plugin Search & Replace, makes easy for use sql inside WP; use the like statement and give you an gui for search/replace strings in content and other tables.
Try with
wp search-replace
.WP-CLI is the command-line interface for WordPress. You can update plugins, configure multisite installations and much more, without using a web browser.