Created
September 14, 2023 11:17
Revisions
-
michael-sumner created this gist
Sep 14, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ # replace "Hello, World!" with appropriate string to search for # replace `post_title` with appropriate column to search for wp site list --fields=url,blog_id | while IFS= read -r line; do url=$(echo "$line" | awk -F'\t' '{print $1}') blog_id=$(echo "$line" | awk -F'\t' '{print $2}') wp post list --field=url --ignore_sticky_posts=1 --orderby=date --order=DESC --post__in=$(wp db query "SELECT ID FROM wp_${blog_id}_posts WHERE post_title LIKE '%Hello, World!%' AND post_status='publish' AND post_type='post'" --skip-column-names --url=${url} | paste -s -d ',' -) --url=${url} done >> log.txt