How to import posts correctly?

You could always give it a try, i’ve imported around 300 posts at the same time before so, it shouldn’t be that big of a deal. You could try the following methods if you have problems with importing them all at once.

  • Try re-defining WP_MEMORY_LIMIT and increase it to i.e. 1024MB
  • Try increasing the max_execution_time (Check this link for more information)
  • Try to split/chunk the array in a few different arrays and add a usleep after every iteration

Please note that within the foreach $id = wp_insert_post() will set $id to the ID of the Post/Page that is being added. If desired you can use this variable to add i.e. meta_values, thumbnails, etc.

Good luck!

tech