This file contains 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
<?php | |
/** | |
* Export WordPress post data to CSV | |
* Based on <http://stackoverflow.com/a/3474698> and <http://ran.ge/2009/10/27/howto-create-stream-csv-php/> | |
*/ | |
/** | |
********************************************************************* | |
* Configuration | |
********************************************************************* |
This file contains 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
# chmod all files in directory, including .hidden files | |
chmod [MODE] .[a-zA-Z0-9_]* | |
# create gzipped tarball, preserving permissions | |
tar -c -p -v -z -f /home/example/www.example.com_site-2013-04-15.tar.gz -C /home/example/ . | |
# Recursively chmod only directories | |
find . -type d -exec chmod 755 {} \; | |
# Similarly, recursively set the execute bit on every directory |
This file contains 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
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 | |
WHERE a.post_type = 'revision'; |
This file contains 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
# Update options | |
UPDATE wp_options SET option_value = REPLACE( option_value, 'staging.com', 'production.com' ); | |
# UPDATE wp_options SET option_value = REPLACE( option_value, '[email protected]', '[email protected]' ); | |
# Update inline images | |
UPDATE wp_posts SET post_content = REPLACE( post_content, 'staging.com', 'production.com' ); | |
# Update image attachment GUID | |
UPDATE wp_posts SET guid = REPLACE( guid, 'staging.com', 'production.com' ) WHERE post_type = 'attachment'; |
NewerOlder