Last active
August 22, 2018 09:40
-
-
Save sp4r74cus/491b44d9b98a619847071382850314ba to your computer and use it in GitHub Desktop.
Query for old posts and update their date fields. Requires the wp-cli-restful package (https://wp-cli.org/restful/).
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
# Linux | |
wp post update $(wp rest post list --before="`date -u +%Y-%m-%dT%H:%M:%SZ -d "1 year ago"`" \ | |
--format=ids --per_page=1) --post_date="`date '+%Y-%m-%d %H:%M:%S'`" --post_date_gmt="`date -u '+%Y-%m-%d %H:%M:%S'`" \ | |
--post_modified="`date '+%Y-%m-%d %H:%M:%S'`" --post_modified_gmt="`date -u '+%Y-%m-%d %H:%M:%S'`" | |
# Mac OSX | |
wp post update $(wp rest post list --before="`date -v -1y +%Y-%m-%dT%H:%M:%SZ`" \ | |
--format=ids --per_page=1) --post_date="`date '+%Y-%m-%d %H:%M:%S'`" --post_date_gmt="`date -u '+%Y-%m-%d %H:%M:%S'`" \ | |
--post_modified="`date '+%Y-%m-%d %H:%M:%S'`" --post_modified_gmt="`date -u '+%Y-%m-%d %H:%M:%S'`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment