Plugin Author
Bowo
(@qriouslad)
I just tested on a fresh WP install and was able to replace a WebP file with another WebP file just fine.
Can you copy the error message here? It might be shown on the page when the error happens, or sent to your email. It may also help if you install Query Monitor plugin, which may show you the error message on the page.
Thanks.
When I try a webp replacement, I get two messages.
The first in the browser.
There has been a critical error on this website. Please check your site admin email inbox for instructions.
The second via email, which gives the following error details:
Error Details
=============
An error of type E_ERROR was caused in line 224 of the file /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-content/plugins/admin-site-enhancements/classes/class-media-replacement.php. Error message: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, bool given in /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-content/plugins/admin-site-enhancements/classes/class-media-replacement.php:224
Stack trace:
#0 /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-content/plugins/admin-site-enhancements/classes/class-media-replacement.php(224): array_key_exists('original_image', false)
#1 /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-content/plugins/admin-site-enhancements/classes/class-media-replacement.php(135): ASENHA\Classes\Media_Replacement->delete_media_files(7838)
#2 /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-includes/class-wp-hook.php(324): ASENHA\Classes\Media_Replacement->replace_media(7838)
#3 /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#4 /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-includes/post.php(4728): do_action('edit_attachment', 7838)
#6 /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-includes/post.php(6295): wp_insert_post(Array, false, true)
#7 /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-includes/post.php(4913): wp_insert_attachment(Array, false, 0, false)
#8 /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-admin/includes/post.php(453): wp_update_post(Array)
#9 /home/virtual/vps-0e85f7/5/5bf0a3e2ec/public_html/wp-admin/post.php(227): edit_post()
#10 {main}
thrown
-
This reply was modified 1 hour, 48 minutes ago by
tormodg.
Plugin Author
Bowo
(@qriouslad)
Thank you. That helped. If you want to try and fix it in the current release, pleas try and replace line 224 to 231 with the following code:
$attachment_original_file_path = wp_get_original_image_path( $post_id );
// Maybe delete the original file if it's an image file, and the original file path exists / was found
if ( $attachment_original_file_path ) {
wp_delete_file( $attachment_original_file_path );
}Will include this fix in the next release. Thanks again for reporting and copying the error message.
