I have nearly 1500 posts in my wordpress blog. Before moving to a new design, I need to tag all these posts with one tag 'old'. How can I do this? I tried to bulk edit posts and it will always go only upto 78 posts every time I tried. I tried increasing server limits and still it won't work! How can I do this?
If you have the ability to use wp-cli on a bash-like shell it's a handy way to do this:
for ID in $(wp post list --post_type=post --post_status=any --field=ID); do wp post term add $ID post_tag old; done
for ID in $(…); dostarts a loop for each line of output of the internal command
wp post list --post_type=post --post_status=any --field=IDlists all post IDs of posts. It's in fact a command line interface to
wp post term add $ID post_tag oldassigns the term
oldof the taxonomy
post_tagto each post of the loop, identified by the loop variable
$ID. If the term does not exist, it gets created on the first time.
donemarks the end of the loop