When moving from a stage site to production, sometimes it’s necessary to update the GUIDs. Doing a quick REPLACE() is an easy way to accomplish this.
UPDATE wp_posts
SET guid = REPLACE(guid, 'http://stage.somesite.com', 'http://www.somesite.com')
WHERE guid LIKE '%http://stage.somesite.com%'
To recursively update the permissions on directories in the uploads directory in WordPress from the wp-contents directory run:
find uploads/ -type d -exec chmod 775 {} +
I find myself copying production databases over stage databases often. In WordPress the uploads directory needs to be copied as well, but I don’t want to copy old stuff over.
From production /wp-content/
cp -Rup uploads/* /websites/stage.somesite.com/public_html/wp-content/uploads/
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
WHERE a.post_type = 'listing'
'Word document' and 'website' don't really go together…