Mar
17
2016

Query WordPress Database for Invalid Media Filenames

WordPress for some reason didn’t use to filter out invalid file names on upload, causing some interesting issues with charsets and rendering (specifically images not loading in browsers).  Using the following queries, you can easily find those items with invalid filenames, and their associated posts (which unfortunately means you’ll still have to replace them)… SELECT ID, post_title, post_content, post_parent, guid FROM wp_posts WHERE post_type = ‘attachment’ AND `post_status` = ‘inherit’ AND (guid LIKE ‘%.jpg’ OR […]

Jun
17
2013

Delete a database

DROP DATABASE `your_database_name`;

Jun
9
2013

Find and replace in MySQL

UPDATE yourtable SET this_field = REPLACE(this_field, ‘replace me’, ‘replacement value’);