Pull Images to WP Media Library
A WordPress plugin to pull all inline images from post content to WP Media Library on post save.
by Rhythm Shahriar <rhythm@newscred.com> · github.com/newscred/nc-wp-pull-images
★ 0stars
3forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/newscred/nc-wp-pull-images/archive/refs/heads/master.zipFrom the readme
This plugin will only work when you are using CMP as your publishing service.
PLUGIN SETUP
REQUIREMENTS
Since uploading images are the synchronous process you might have to increase resource limits in php.ini
but preferable limits are according to your usages blow limits are just
WHITELIST DOMAIN(S)
This plugin will pull images from only whitelisted domains (LINE:22)
BLACKLIST DOMAIN(S)
If you want to ignore any domain from being pulled, update the domainwhitelist array (LINE:33)
WORK PROCESS
- For this use case, there are two possible actions: you are creating a new post or you are updating the post.
- If you are creating a new post, this will pull all the inline images from img src and create store those in the WordPress media library.
After that, it will create a new custom field, nc-cmp-ml-images, and save a JSON of CMP & WP URL mapping so that we can track or reuse in future rater pull the same images multiple times.
- If you are updating the post, it will first check if there is any custom field nc-cmp-ml-images to find out if the image(s) is/are already pulled.
If there any match found, then instead of re-pull the images, this plugin wi