phpwordpresswp-cli

WP-CLI doesn't regenerate media


I am trying regenerate the all media via WP-CLI the command below:

wp media regenerate --yes

Unfortunately, it's return me the error:

No support for generating images found. Please install the Imagick or GD PHP extensions

Then I install the Imagick and GD extensions, but it's not help me. Have any ideas?

The output command php -m:

[PHP Modules]
bcmath
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
hash
iconv
imagick

Solution

  • I found the problem it was the hook below:

    function use_gd_editor($array): array
    {
        return array('WP_Image_Editor_GD',);
    }
    
    add_filter('wp_image_editors', 'use_gd_editor');
    

    I removed this code and it's work fine.