Store post ids during `wp post generate`.

Fixes --max_depth which was broken in fe2be3169b.
Closes #820.