PHP Fatal error
-
Hello,
thanks for a great plugin, I use it for year, but now I just found scenario where it’s not working
I want WP to delete all connected attachments when post is deleted, so I use:
add_action( 'before_delete_post', 'maybe_delete_post_attachments', 10, 1 ); function maybe_delete_post_attachments( $post_id ){ if( get_post_type( $post_id ) == 'inzerat' ){ $attachments = get_attached_media( '', $post_id ); foreach( $attachments as $attachment ){ wp_delete_attachment( $attachment->ID, 'true' ); } } }
but it’s not working because of Fly Dynamic Image Resizer:
PHP Fatal error: Uncaught Error: Call to undefined function JB\FlyImages\WP_Filesystem() in /wp-content/plugins/fly-dynamic-image-resizer/inc/class-core.php:114 Stack trace: #0 /wp-includes/class-wp-hook.php(289): JB\FlyImages\Core->delete_attachment_fly_images(374) #1 /wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) #2 /wp-includes/plugin.php(484): WP_Hook->do_action(Array) #3 /wp-includes/post.php(5940): do_action('delete_attachme...', 374, Object(WP_Post)) #4 /wp-content/themes/xxx/functions.php(1020): wp_delete_attachment(374, 'true') #5 /wp-includes/class-wp-hook.php(289): maybe_delete_post_attachments(373) #6 /wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) #7 /wp-includes/plugin.php(484): WP_Hook->do_action(Array) #8 /wp-includes/post.php(3038): do_action('before_delete_p...', 373, Object(WP_Post)) #9 /wp-content/themes/xxx/functions.php(1009): wp_delete_post(373, true) #10 /wp-includes/class-wp-hook.php(287): get_delete_old_posts() #11 /wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array) #12 /wp-includes/plugin.php(551): WP_Hook->do_action(Array) #13 /wp-cron.php(138): do_action_ref_array('delete_old_post...', Array) #14 {main}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP Fatal error’ is closed to new replies.