#!/bin/bash
# Requires wp-cli
# Format is: "OldPostID|NewPostID"
POSTS=(
"15925|43314"
"1804|43425"
)
for post in "${POSTS[@]}"
do
old=$(echo "${post}"|awk -F "|" '{print $1}')
new=$(echo "${post}"|awk -F "|" '{print $2}')
wp comment update $(wp comment list --post_id=${old} --field=ID) --comment_post_ID=${new}
wp comment recount ${old} ${new}
done
Moves comments from one post to another and then recounts each post's comment count. **Requires WP-Cli**
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.