Plugin auto-upload-images không down image link bắng đầu bằng // không phải http

Sửa file: /wp-content/plugins/auto-upload-images/src/WpAutoUpload.php

 

Thêm 3 dòng vào hàm save:

  1. public function save($post)
  2. {
  3. $excludePostTypes = self::getOption('exclude_post_types');
  4. if (is_array($excludePostTypes) && in_array($post->post_type, $excludePostTypes, true)) {
  5. return false;
  6. }
  7.  
  8. global $wpdb;
  9. $content = $post->post_content;
  10. $images = $this->findAllImageUrls($content);
  11. if ($images === null || empty($images)) {
  12. return false;
  13. }
  14.  
  15. foreach ($images as $image) {
  16. $imgurl = $image['url'];
  17. if (substr($imgurl,0,2) == "//")
  18. $imgurl = "http:".$imgurl;

Leave a Reply

You must be logged in to post a comment.