Created
February 5, 2016 15:42
-
-
Save danielhomer/892d45ad7cccaaf5b12a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /path/to/root | |
for id in $(wp site list --field=blog_id) | |
do | |
echo ${id} | |
mysql -h##HOST## -u##USER## -p##PASSWORD## -e "DELETE FROM wp_${id}_postmeta WHERE meta_key LIKE '_oembed_%' and meta_key NOT LIKE '_oembed_time_%' and meta_value NOT LIKE '%>' AND meta_value != '{{unknown}}';" ##DB_NAME## | |
echo Flushed dodgy OEmbeds from site ${id} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey Daniel,
Do you know how I could convert this into a PHP script that I could create a daily cron job for so that my site could daily check for corrupt oembed caches?