<?php
/**
* Plugin Name: DTQ Fix Image Editor to GD
* Description: Ưu tiên GD library khi WordPress xử lý ảnh, giúp tránh lỗi "The server cannot process the image" do xung đột ImageMagick. File mu-plugin: tự động chạy, không cần kích hoạt, không bị mất khi đổi theme.
* Version: 1.0
* Author: Đỗ Trung Quân
*/
if (!defined('ABSPATH')) {
exit;
}
function dtq_fix_image_editor_default_to_gd_library($editors) {
$gd_editor = 'WP_Image_Editor_GD';
$editors = array_diff($editors, [$gd_editor]);
array_unshift($editors, $gd_editor);
return $editors;
}
add_filter('wp_image_editors', 'dtq_fix_image_editor_default_to_gd_library');