Support » Plugin: WebP Converter for Media - Convert WebP & Optimize Images » WP backend blocked after plugin update if content directory is not /wp-content/

  • Resolved devopti

    (@devopti)


    Hello,

    After plugin update (2.4.0 -> 3.0.0) an error occurs and blocks the access to the WordPress backend.
    We use iTheme Security plugin and our content directory is changed from /wp-content/ to /files/.

    Some error details:

    Aktuelles Plugin: WebP Converter for Media (Version 3.0.0)
    PHP-Version 7.4.16

    Fehler-Details
    ==============
    Ein Fehler vom Typ E_ERROR wurde in der Zeile 97 der Datei
    /var/www/html/files/plugins/webp-converter-for-media/src/Conversion/Directory/DirectoriesIntegration.php
    verursacht. Fehlermeldung: Uncaught TypeError: Return value of
    WebpConverter\Conversion\Directory\DirectoriesIntegration::get_dir_as_name()
    must be of the type string, null returned in
    /var/www/html/files/plugins/webp-converter-for-media/src/Conversion/Directory/DirectoriesIntegration.php:97
    Stack trace:
    #0 /var/www/html/wp-includes/class-wp-hook.php(292):
    WebpConverter\Conversion\Directory\DirectoriesIntegration->get_dir_as_name()
    #1 /var/www/html/wp-includes/plugin.php(212): WP_Hook->apply_filters()
    #2 /var/www/html/files/plugins/webp-converter-for-media/src/Conversion/Directory/DirectoriesIntegration.php(112):
    apply_filters()
    #3 /var/www/html/wp-includes/class-wp-hook.php(292):
    WebpConverter\Conversion\Directory\DirectoriesIntegration->get_dir_as_path()
    #4 /var/www/html/wp-includes/plugin.php(212): WP_Hook->apply_filters()
    #5 /var/www/html/files/plugins/webp-converter-for-media/src/Loader/HtaccessLoader.php(62):
    apply_filters()
    #6 /var/www/html/files/plugins/webp-converter-for-media/src/Loader/HtaccessLoader.php(35):
    WebpConverter\L

    We reverted back to the older version of the plugin (2.4.0).
    Can you provide some help?

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hello @devopti,

    Thanks for your message.

    What filters do you use to modify directories used by the plugin?

    Best,
    Mateusz

    Thread Starter devopti

    (@devopti)

    Thank you for a quick response.

    Our functions.php filters:

    add_filter( ‘webpc_uploads_root’, function( $path ) {
    return ‘/var/www/html/’;
    } );

    add_filter( ‘webpc_dir_path’, function( $path, $directory ) {
    switch ($directory) {
    case ‘uploads’:
    return ‘/var/www/html/files/uploads’;
    case ‘webp’:
    return ‘/var/www/html/files/uploads-webpc’;
    }
    return $path;
    }, 10, 2 );

    I forgot to write that we are running an nginx server.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @devopti Please download the plugin version in which I implemented the fix for your problem:
    https://gbiorczyk.pl/webp-converter-for-media-v3.0.1.zip

    Additionally, please use this set of filters (only use the filters listed in the plugin FAQ as I will support them long term):

    add_filter( 'webpc_uploads_root', function( $path ) {
        return '/var/www/html/';
    } );
    
    add_filter( 'webpc_dir_name', function( $path, $directory ) {
        switch ( $directory ) {
            case 'uploads':
                return 'files/uploads';
            case 'webp':
                return 'files/uploads-webpc';
        }
        return $path;
    }, 10, 2 );
    Thread Starter devopti

    (@devopti)

    Everything is working fine now.

    Thank you very much for your support.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.