Last active
January 18, 2024 22:58
-
-
Save twentyfortysix/72c4609f16b0709e71e3652900b352d2 to your computer and use it in GitHub Desktop.
partial WP export-import
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
# Export each post individually | |
POST_IDS=$(wp post list --post_type=locations --meta_key=page_subtype --meta_value=event --format=ids) | |
for ID in $POST_IDS; do | |
TIMESTAMP=$(date +"%Y%m%d_%H%M%S") | |
wp export --dir=export --post__in=$ID | |
mv export/doprcenakole.wordpress.*.xml export/${TIMESTAMP}.xml | |
done | |
# Switch to the other WordPress installation | |
cd /path/to/other/wordpress/installation | |
# Import each XML file | |
for FILE in ../../dev.dopracenakole.cz/bedrock/export/*.xml; do | |
wp import $FILE --authors=create | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment