Skip to content

Instantly share code, notes, and snippets.

@wpjess
Created June 10, 2020 21:50
Show Gist options
  • Save wpjess/74f276fee9f3cab9a58b6f0c309f57d6 to your computer and use it in GitHub Desktop.
Save wpjess/74f276fee9f3cab9a58b6f0c309f57d6 to your computer and use it in GitHub Desktop.
Update WordPress post terms for group of IDs
#!/bin/bash
# Store the file post_ids as a variable
POST_IDS=$(<post_ids)
# Loop through each of these IDs
for POST_ID in $POST_IDS
do
wp-cli post term set "$POST_ID" category uncategorized --path=/htdocs/__wp__
echo "Processing post ID $POST_ID..."
done
@wpjess
Copy link
Author

wpjess commented Jun 10, 2020

post_ids is a simple file containing a list of IDs, like so:

17635
9863
12904
31220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment