How do I extract the contents of a CPT’s custom field for all posts?
I managed to achieve what I wanted by piping wp-cli with xargs and grep, like this: wp post list –post_type=CPTNAME –field=ID | xargs -n 1 wp post meta list –format=csv | grep -E “^[[:digit:]]*,(CUSTOMFIELD1|CUSTOMFIELD2|…|CUSTOMFIELDN)” >> file.csv This is, however, extremely slow, taking more than 30 minutes for 10 thousand CPTs. I think a direct SQL … Read more