WARNING: you *need* to adjust the regex to find the entry ID
Inspiration: https://community.gravityforms.com/t/how-to-bulk-delete-old-entries-using-wp-cli/11209/2
cd ~/public_html
end_date=`date -d "3 years ago" +%y-%m-%d`
# yy-mm-dd
wp-cli gf entry export 1 --start_date=70-01-01 --end_date=${end_date} ~/out1.csv
wp-cli gf entry delete $(awk 'match($0, /"([0-9]+)","20([0-9]+)-/, m) { print m[1] }' ~/out1.csv | sed 's/[^[:digit:]]\+//g'|paste -d\ -s) --force
## rm ~/out1.csv
Leave a Reply