Answer the question
In order to leave comments, you need to log in
How to programmatically create multiple comments in WordPress?
There is an array with data for comments. There can be a lot of (for 700 pieces) elements in an array. And if I just iterate over each using wp_new_comment()
then I run into 504 Gateway Timeout
. Is there a way to add an array of comments in one go? Or do it somehow faster?
Answer the question
In order to leave comments, you need to log in
You need to set a higher fastcgi_read_timeout value in the nginx settings
You can also figure out which tables which data WP adds when creating a comment, and write a script that writes the whole thing right away to the database with the condition that the previous iteration in the cycle is performed, or with a small time delay.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question