Get all posts as an array ID => Name

You’re trying to make WP_Query give you everything in a single API call, but that won’t work.

Instead, break it down into multiple steps, e.g.:

  • Create an empty list
  • fetch all the posts
  • foreach post:
    • add its ID and name to the list
  • you now have alist of ID’s and names