File: //tmp/setdate.sh
#!/bin/bash
SLUG="gabinet-masazu-piotr-czajkowski-kielce"
python3 -c "import json; [print(k+'|'+v) for k,v in json.load(open('/tmp/dates.json')).items()]" | while IFS='|' read d dt; do
P="/var/www/$d"
[ ! -f "$P/wp-config.php" ] && continue
WPU="sudo -u www-data wp --path=$P --allow-root --skip-themes --skip-plugins"
pid=$($WPU post list --post_type=post --name="$SLUG" --field=ID 2>/dev/null | head -1)
[ -z "$pid" ] && continue
$WPU post update $pid --post_date="$dt" --post_date_gmt="$dt" >/dev/null 2>&1
pfx=$($WPU db prefix 2>/dev/null)
$WPU db query "UPDATE ${pfx}posts SET post_modified='$dt', post_modified_gmt='$dt' WHERE ID=$pid" >/dev/null 2>&1
echo "$d|$($WPU post get $pid --field=post_date 2>/dev/null)"
done