Fatal error when deleting image
-
When we try and delete an image from the media library, we see the following server error:
Fatal error: Uncaught Error: Class 'WP_Filesystem_Direct' not found in /home/wordpress-sites/######/httpdocs/app/plugins/gt3-photo-video-gallery/core/class-watermark.php:200 Stack trace: #0 /home/wordpress-sites/######/httpdocs/app/plugins/gt3-photo-video-gallery/core/class-watermark.php(153): GT3\PhotoVideoGallery\Watermark::check_folder() #1 /home/wordpress-sites/######/httpdocs/app/plugins/gt3-photo-video-gallery/core/class-watermark.php(36): GT3\PhotoVideoGallery\Watermark::restore(3462) #2 /home/wordpress-sites/######/httpdocs/wp/wp-includes/class-wp-hook.php(289): GT3\PhotoVideoGallery\Watermark::delete_attachment_handler(3462) #3 /home/wordpress-sites/######/httpdocs/wp/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) #4 /home/wordpress-sites/######/httpdocs/wp/wp-includes/plugin.php(478): WP_Hook->do_action(Array) #5 /home/wordpress-sites/######/httpdocs/wp/wp-includes/post.php(5815): do_action('delete_attachme...', 3462, Object(WP_Post)) #6 /home/wordpress-sites/######/httpd in /home/wordpress-sites/######/httpdocs/app/plugins/gt3-photo-video-gallery/core/class-watermark.php on line 200
The WP_Filesystem_Direct class isn’t found (the rest of the site works without any problems).
I ran a few tests in class-watermark.php and added the extra includes:
require_once(ABSPATH.'wp-admin/includes/file.php'); require_once(ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php'); require_once(ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.p$ require_once(ABSPATH . '/wp-includes/class-wp-error.php'); WP_Filesystem();
This seemed to work, although I don’t see the problem on a local developer copy of the website. The admin
file.php
include works asfunction_exists('WP_Filesystem');
returns true.Can you please advise what the issue may be here?
- The topic ‘Fatal error when deleting image’ is closed to new replies.