problem with wp_generate_attachment_metadata hook
-
Hi!
I have written a script that reads an rss feed and imports the posts.
I also import the thumbnails the following way:$attach_id = wp_insert_attachment( $attachment, $file, $new_post_id ); require_once( ABSPATH . 'wp-admin/includes/image.php' ); $attach_data = wp_generate_attachment_metadata( $attach_id, $file ); $res1 = wp_update_attachment_metadata( $attach_id, $attach_data ); $res2 = set_post_thumbnail( $new_post_id, $attach_id );
it worked fine, but then I have installed and swithsched off kraken plugin, and I started to get warnings:
[14-Feb-2018 06:55:21 UTC] PHP Warning: copy(D:wampwwwterranpublic/wp-content/uploads/2018/02/7d9da6330ec28ae06c1f1415bf9d7063_d49afe6e3b4eb7cadfe308837303ec67.jpg_kraken_3644bc02f81e686d61bdfaf2469607c0): failed to open stream: No such file or directory in D:\wamp\www\terran\public\wp-content\plugins\kraken-image-optimizer\kraken.php on line 1202
[14-Feb-2018 06:55:21 UTC] PHP Stack trace:
[14-Feb-2018 06:55:21 UTC] PHP 1. {main}() D:\wamp\www\terran\public\index.php:0
[14-Feb-2018 06:55:21 UTC] PHP 2. require() D:\wamp\www\terran\public\index.php:17
[14-Feb-2018 06:55:21 UTC] PHP 3. require_once() D:\wamp\www\terran\public\wp-blog-header.php:19
[14-Feb-2018 06:55:21 UTC] PHP 4. include() D:\wamp\www\terran\public\wp-includes\template-loader.php:74
[14-Feb-2018 06:55:21 UTC] PHP 5. include() D:\wamp\www\terran\public\wp-content\themes\terran\base.php:22
[14-Feb-2018 06:55:21 UTC] PHP 6. get_template_part() D:\wamp\www\terran\public\wp-content\themes\terran\archive.php:2
[14-Feb-2018 06:55:21 UTC] PHP 7. locate_template() D:\wamp\www\terran\public\wp-includes\general-template.php:155
[14-Feb-2018 06:55:21 UTC] PHP 8. load_template() D:\wamp\www\terran\public\wp-includes\template.php:647
[14-Feb-2018 06:55:21 UTC] PHP 9. require() D:\wamp\www\terran\public\wp-includes\template.php:690
[14-Feb-2018 06:55:21 UTC] PHP 10. Yco\Terran\PostTypes\News\cron_task() D:\wamp\www\terran\public\wp-content\themes\terran\templates\archives\archive-news.php:13
[14-Feb-2018 06:55:21 UTC] PHP 11. wp_generate_attachment_metadata() D:\wamp\www\terran\public\wp-content\themes\terran\lib\post_types\news.php:85
[14-Feb-2018 06:55:21 UTC] PHP 12. apply_filters() D:\wamp\www\terran\public\wp-admin\includes\image.php:293
[14-Feb-2018 06:55:21 UTC] PHP 13. WP_Hook->apply_filters() D:\wamp\www\terran\public\wp-includes\plugin.php:203
[14-Feb-2018 06:55:21 UTC] PHP 14. Wp_Kraken->optimize_thumbnails() D:\wamp\www\terran\public\wp-includes\class-wp-hook.php:288
[14-Feb-2018 06:55:21 UTC] PHP 15. copy() D:\wamp\www\terran\public\wp-content\plugins\kraken-image-optimizer\kraken.php:1202
As far as I can see, the optimize thumbnails using the wp_generate_attachment_metadata hook, and that is causing a problem here.
How can I solve this issue?
Thank you!The page I need help with: [log in to see the link]
- The topic ‘problem with wp_generate_attachment_metadata hook’ is closed to new replies.