I've migrated content from a CMS (not WP) to Wordpress, through a nodejs script that uses the package wpapi (https://github.com/WP-API/node-wpapi). The main image is set as a featured image in Wordpress. The image is created, assigned to the post id, but unfortunately, thumbnails are not generated (there are no other available sizes). Instead, if I upload an image view the Wordpress UI, feature image feature, the thumbnails are generated or different file sizes are available.

For this reason, I'd like to know if there is an endpoint to do this programmatically, to generate thumbnails and assign to a post or featured image using the Wordpress rest API?

Note: images are stored in S3 bucket and accessed through the cdn, cloudfront. Using media cloud plugin. Media cloud has a tool to regenerate plugins that doesn't work.

  • You can just install a plugin (there are a couple...) from the repository that will scan all of the media in your WP install and "regenerate" the media sizes. – rudtek Nov 18 at 18:18
  • The images are stored in a S3 bucket and accessed by a cdn address cloudfront. I'm looking for the endpoint, or even find how this is set in the database as last resort – punkbit Nov 18 at 23:40
  • Most CDN plugins listen to WordPress core hooks and upload generated thumbnails to their service once created. Generation may be slower due to uploading the images to the 3rd party service as it progresses. – rudtek Nov 19 at 15:44
  • You could try using WP-CLI ... wp media regenerate --yes – rudtek Nov 19 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.