Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #46 from junaidbhura/fix/40-delete-error
Browse files Browse the repository at this point in the history
Fix warning when deleting images in some cases
  • Loading branch information
junaidbhura authored Apr 1, 2021
2 parents a30eb08 + e18396c commit ec81450
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inc/class-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ public function media_row_action( $actions, $post ) {
* @return boolean
*/
public function delete_attachment_fly_images( $attachment_id = 0 ) {
if ( ! function_exists( 'WP_Filesystem' ) ) {
return false;
}

WP_Filesystem();
global $wp_filesystem;
return $wp_filesystem->rmdir( $this->get_fly_dir( $attachment_id ), true );
Expand All @@ -122,6 +126,10 @@ public function delete_attachment_fly_images( $attachment_id = 0 ) {
* @return boolean
*/
public function delete_all_fly_images() {
if ( ! function_exists( 'WP_Filesystem' ) ) {
return false;
}

WP_Filesystem();
global $wp_filesystem;

Expand Down

0 comments on commit ec81450

Please sign in to comment.