I am attempting to creating a number of new posts on my site through data provided by an API. All in, there would be around 75,000+ new posts.

I had previously hooked into the init action and set the priority to 999 and ran a function that grabbed the data from the API and then looped through it all and used the wp_insert_post function to add the data to a new post.

Is there a better way to do this? I wasn't certain if the wp-cli offered any capabilities for this.

  • 1
    Writing a custom CLI command to run the import is definitely a performant option. Using scheduled actions (ex: Action Scheduler) would also be a performant (though slower) approach.
    – Caleb
    Dec 2, 2023 at 15:51


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.