Skip to content

Instantly share code, notes, and snippets.

@khoipro
Last active September 10, 2024 04:20
Show Gist options
  • Save khoipro/ec1a349240d09349c76965bedccf551c to your computer and use it in GitHub Desktop.
Save khoipro/ec1a349240d09349c76965bedccf551c to your computer and use it in GitHub Desktop.
Fix image not upload in WordPress
<?php
// Error while uploading image: The server cannot process the image. This can happen if the server is busy or does not have enough resouces to complete the task.
// Error (Vietnamese): Máy chủ không thể xử lý hình ảnh.
function codetot_image_editor_default_to_gd_library( $editors ) {
$gd_editor = 'WP_Image_Editor_GD';
$editors = array_diff( $editors, array( $gd_editor ) );
array_unshift( $editors, $gd_editor );
return $editors;
}
add_filter( 'wp_image_editors', 'codetot_image_editor_default_to_gd_library' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment