I have a plugin that attaches images automatically to my posts. It works just fine, except for when I have WP Smush.it enabled. It's an external php page to my basic WP theme, so it isn't running in the context of my site except for these two includes.
require_once( "/home1/derekper/public_html/soccerreviews/wp-blog-header.php" ); require_once( ABSPATH . 'wp-admin/includes/image.php' );
Here is my code that attaches the meta data.
$attach_id = wp_insert_attachment( $attachment, $filename, $postid ); $attach_data = wp_generate_attachment_metadata( $attach_id, $filename ); wp_update_attachment_metadata( $attach_id, $attach_data );
This is the error that I'm getting.
Fatal error: Call to undefined function download_url() in /home1/derekper/public_html/soccerreviews/wp-content/plugins/wp-smushit/wp-smushit.php on line 172
Any ideas why this is happening? I tried requiring the wp-smushit.php file directly, but it gave me the same error.