# האם ניתן ליצור קבוצות של פוסטים עבור פוסטים רבים של WordPress? אולי SQL?

**URL:** <https://meta.discourse.org/t/is-it-possible-to-bulk-create-threads-for-many-wordpress-posts-sql-maybe/201210>\
**Category:** WordPress\
**Created:** [21 באוגוסט,‏ 2021,‏ 2:30am UTC](https://meta.discourse.org/t/is-it-possible-to-bulk-create-threads-for-many-wordpress-posts-sql-maybe/201210 "2021-08-21T02:30:45Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [23 באוגוסט,‏ 2021,‏ 5:23am UTC](https://meta.discourse.org/t/is-it-possible-to-bulk-create-threads-for-many-wordpress-posts-sql-maybe/201210/6 "2021-08-23T05:23:22Z")

</div>

As others have mentioned, the easiest way of doing this currently is via the [WP Discourse](https://github.com/discourse/wp-discourse) plugin. Updating the dbs of each instance directly raises two potential issues:

1. It requires you to understand all of the data and metadata being stored on each instance.
2. The data and metadata is interdependent, i.e. after a post is successfully published from Wordpress to Discourse the id of the post in Discourse is saved to a post meta field in Wordpress.

If you were already familiar with both 1 and 2, then yes updating the dbs directly might be a good option, but considering you’re not, it’s not a good idea unless you want to spend time learning that just for this purpose. In that vein, you could hire someone to do this for you, however I would recommend you just use the [WP Discourse](https://github.com/discourse/wp-discourse) plugin’s functionality instead.

Using the [WP Discourse](https://github.com/discourse/wp-discourse) plugin has the additional benefit of logging already being setup for [WP Discourse](https://github.com/discourse/wp-discourse) publishing, which means you’ll get detailed, post-specific information if any of the publications fail.

It’s true that this will mean 1000-odd POST requests to your Discourse as the [WP Discourse](https://github.com/discourse/wp-discourse) plugin only POSTs one topic at a time, however considering this is a one-time migration, you can handle this by breaking it up into batches and through pauses (i.e. sleep) in the script. I would recommend doing a manual check after the first few batches to see it’s working as you expect.

In terms of the script itself, you would use the `WPDiscourse\DiscoursePublish` method [`publish_post_after_save`](https://github.com/discourse/wp-discourse/blob/master/lib/discourse-publish.php#L111) for each post, i.e. in a loop (with appropriate batching and sleep).

---

_[View the full topic](https://meta.discourse.org/t/is-it-possible-to-bulk-create-threads-for-many-wordpress-posts-sql-maybe/201210)._
