We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7c87da7 commit 207817bCopy full SHA for 207817b
1 file changed
search-posts-media-library.sh
@@ -38,7 +38,7 @@ for site_id in $all_site_ids; do
38
FROM
39
wp_${site_id}_posts p
40
LEFT JOIN
41
- wp_3_postmeta pm1 ON (p.ID = pm1.post_id AND pm1.meta_key = '_wp_attached_file')
+ wp_${site_id}_postmeta pm1 ON (p.ID = pm1.post_id AND pm1.meta_key = '_wp_attached_file')
42
WHERE
43
p.post_type = 'attachment'"
44
@@ -47,7 +47,8 @@ for site_id in $all_site_ids; do
47
sql_query="$sql_query AND p.post_title REGEXP '${search_regex}'"
48
fi
49
50
- wp_skip_all db query --skip-column-names "$sql_query" | tee -a $output_file;
+ # Run the wpcli command | use sed to replace tabs with commas | output to shell and file.
51
+ wp_skip_all db query --skip-column-names "$sql_query" | sed -E 's/"/""/g; s/\t/","/g; s/^/"/; s/$/"/' | tee -a $output_file;
52
53
done;
54
0 commit comments