I am trying to Creat Wordpress website that will contain 10 Million post, such that when i upload a single its become a post with it's own name as title. and i am importing these images with Wp-cli. now the problem i am facing is that i have uploaded about half a million images and now Wordpress has become slow, its taking too much time to import images. please suggest me any solution for this

Images Importing goes slow down, Server usage only 1% i am doing this Via WP-cli with this command

wp media import ~/Pictures/processed-images-medium/\*\*\/\*.jpg

every time when image upload its become a Unique post you can check it at here

  • You mean the import is slowing down, or that browsing your website is slow? Are you importing all images to a single post? Try to profile it to find the bottleneck. Maybe it's the process of determining the unique slug that's getting slower? Please update your question with more detail to increase the change of someone giving a useful answer.
    – birgire
    Commented Dec 30, 2018 at 15:04
  • i have update the Question please check it now, Thanks
    – Shoabch
    Commented Dec 30, 2018 at 15:06
  • Try e.g. to log the time for e.g. wp_insert_post() and wp_unique_post_slug() on your dev install and try to look for suitable hooks for that. The wp profile command might also give info on your site.
    – birgire
    Commented Dec 30, 2018 at 15:35
  • Could you please explain it how i can do it?
    – Shoabch
    Commented Dec 30, 2018 at 15:48
  • 2
    You might also get an indication by running those WP functions within the wp shell with a timer (search e.g. for microtime in PHP) or e.g. try it with wp profile eval <php-code>. You can also look at it from within the wp-admin backend, with a profiling plugin like the Query Monitor and try e.g. to see if it gives any information when you manually upload a file. Note that this site does not favor long comment discussion, so it's recommended to give as much detail in the question to increase the change for someone being able to give a useful answer.
    – birgire
    Commented Dec 30, 2018 at 16:15

1 Answer 1


You need to either read more about database optimization or hire a specialist and distribute those posts possibly on multiple database and file servers. Even if you build a custom solution it would be slow so don't blame WP.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.