Title: mathieu's Replies | WordPress.org

---

# mathieu

  [  ](https://wordpress.org/support/users/mathieu/)

 *   [Profile](https://wordpress.org/support/users/mathieu/)
 *   [Topics Started](https://wordpress.org/support/users/mathieu/topics/)
 *   [Replies Created](https://wordpress.org/support/users/mathieu/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/mathieu/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/mathieu/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/mathieu/engagements/)
 *   [Favorites](https://wordpress.org/support/users/mathieu/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 57 total)

1 [2](https://wordpress.org/support/users/mathieu/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/mathieu/replies/page/3/?output_format=md)
[4](https://wordpress.org/support/users/mathieu/replies/page/4/?output_format=md)
[→](https://wordpress.org/support/users/mathieu/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Redis Object Cache] Support Request: Redis Object Cache Plugin – Connection Issues and Errors](https://wordpress.org/support/topic/support-request-redis-object-cache-plugin-connection-issues-and-errors/)
 *  [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/support-request-redis-object-cache-plugin-connection-issues-and-errors/#post-18003949)
 * I have the same issue… it’s happening way too often.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[StockPack – Stock photos from Unsplash, Adobe Stock and more] Is there an utility for admin_enqueue_scripts in class.settings-api.php ?](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/#post-17843300)
 * Thanks a lot 🙂 Have a nice weekend!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[StockPack – Stock photos from Unsplash, Adobe Stock and more] Is there an utility for admin_enqueue_scripts in class.settings-api.php ?](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/#post-17839433)
 * If the php would noticably slow down the experience for the people I pay to write
   content, absolutely.
   But I don’t feel that is the case with your plugin anymore
   since you stop enqueuing the media player everywhere.If every plugin would always
   load everything on every call with no regards to performance it would get bloated
   quick.I run a tight ship 🙂
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[StockPack – Stock photos from Unsplash, Adobe Stock and more] Is there an utility for admin_enqueue_scripts in class.settings-api.php ?](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years ago](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/#post-17833080)
 * Yes it works well but you are still loading a tons of templates for nothing.
 *     ```wp-block-code
               public function templates()        {            if (did_action('wp_enqueue_media') || (isset($_GET['page']) && $_GET['page'] === 'stockpack')) {                include_once(__DIR__ . '/../templates/attachment.php');                include_once(__DIR__ . '/../templates/empty.php');                include_once(__DIR__ . '/../templates/details.php');                include_once(__DIR__ . '/../templates/downloader.php');                include_once(__DIR__ . '/../templates/dialog.php');                include_once(__DIR__ . '/../templates/attribution.php');                include_once(__DIR__ . '/../templates/no-search.php');            }        }
       ```
   
 * Otherwise it works very well.
 * Hopes I am not getting too annoying.
 * I am just in a phase where I am optimizing everything and your plugin is good
   enough that I am willing to go deep in the code to help you make it better.
 * Cheers.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[StockPack – Stock photos from Unsplash, Adobe Stock and more] Is there an utility for admin_enqueue_scripts in class.settings-api.php ?](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years ago](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/#post-17825360)
 * Thanks 🙂 please let me know.
 * Have a nice weekend.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[StockPack – Stock photos from Unsplash, Adobe Stock and more] Is there an utility for admin_enqueue_scripts in class.settings-api.php ?](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years ago](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/#post-17824319)
 * Hi,
 * Great, however, I discovered that it creates other issue on pages that doesn’t
   have the media player loaded. You seem to load pretty much everything on everypage
   even if there is no upload happening on a page.
 *     ```wp-block-code
       stockpack-load-admin.js?ver=3.2.4:1 Uncaught TypeError: Cannot read properties of undefined (reading 'search')    at Object.<anonymous> (stockpack-load-admin.js?ver=3.2.4:1:20702)    at i (stockpack-load-admin.js?ver=3.2.4:1:110)    at Module.<anonymous> (stockpack-load-admin.js?ver=3.2.4:1:51573)    at i (stockpack-load-admin.js?ver=3.2.4:1:110)    at Object.<anonymous> (stockpack-load-admin.js?ver=3.2.4:1:51525)    at i (stockpack-load-admin.js?ver=3.2.4:1:110)    at stockpack-load-admin.js?ver=3.2.4:1:903    at stockpack-load-admin.js?ver=3.2.4:1:912
       ```
   
 * I do however have a fix AND a tricks that solves the issue.
 * The idea is to check if did_action(“wp_enqueue_media”) is true
 * In class-stockpackmedia.php, you can do this, it works
 *     ```wp-block-code
               public function enqueue($admin = true, $no_dialog = false)        {            if (did_action('wp_enqueue_media')) {                $this->enqueue_script($admin);                $this->enqueue_style($no_dialog);                $this->enqueue_settings($admin);            }        }
       ```
   
 * But I think there’s a better way that keeps your exact same logic and doesn’t
   messed up anything.
 * The idea is to use stockpack_frontend_load later when enqueue scripts are called.
   That makes the “frontend_load_stockpack” filter much more useful.
 * Here’s what I tested successfuly.
 *     ```wp-block-code
               public function enqueue($admin = true, $no_dialog = false)        {            if (stockpack_frontend_load()) {                $this->enqueue_script($admin);                $this->enqueue_style($no_dialog);                $this->enqueue_settings($admin);            }        }                        public function templates()        {            if (stockpack_frontend_load()) {                include_once(__DIR__ . '/../templates/attachment.php');                include_once(__DIR__ . '/../templates/empty.php');                include_once(__DIR__ . '/../templates/details.php');                include_once(__DIR__ . '/../templates/downloader.php');                include_once(__DIR__ . '/../templates/dialog.php');                include_once(__DIR__ . '/../templates/attribution.php');                include_once(__DIR__ . '/../templates/no-search.php');            }        }        public function enqueue_frontend()        {            if (stockpack_frontend_load()) {                $this->enqueue(false);            }        }        public function load_frontend_style()        {            if (stockpack_frontend_load()) {                wp_enqueue_style('stockpack-frontend', plugins_url('/dist/css/stockpack-frontend.css', STOCKPACK_DIR), false, $this->version);            }        }
       ```
   
 * And then somebody can filter it out with :
 *     ```wp-block-code
           add_filter("frontend_load_stockpack", function ($load) {        if (!did_action("wp_enqueue_media")) {            return false;        } else {            return $load;        }    });
       ```
   
 * Let me know what you think
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[StockPack – Stock photos from Unsplash, Adobe Stock and more] Is there an utility for admin_enqueue_scripts in class.settings-api.php ?](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years ago](https://wordpress.org/support/topic/is-there-an-utility-for-admin_enqueue_scripts-in-class-settings-api-php/#post-17809387)
 * Thanks 🙂
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF] Fatal error on REST API image upload in 5.6.0](https://wordpress.org/support/topic/fatal-error-on-rest-api-image-upload-in-5-6-0/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-on-rest-api-image-upload-in-5-6-0/#post-17744355)
 * No problem. Thanks.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF] Fatal error on REST API image upload in 5.6.0](https://wordpress.org/support/topic/fatal-error-on-rest-api-image-upload-in-5-6-0/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-on-rest-api-image-upload-in-5-6-0/#post-17744202)
 * Hi Pedro,
 * Yes, It works !
 * thanks a lot. Do you have an idea on when you push the new release?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF] PHP Fatal error: Uncaught Error: Call to a member function isProcessable()](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-a-member-function-isprocessable/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-a-member-function-isprocessable/#post-17212342)
 * So far so good. But I don’t know what triggered it so I can’t really test it 
   besides monitoring log. I’ll check it closely and keep you updated.
 * Have a great weekend.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF] PHP Fatal error: Uncaught Error: Call to a member function isProcessable()](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-a-member-function-isprocessable/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-a-member-function-isprocessable/#post-17207971)
 * I am sorry, I don’t have a testing platform but I will test it out when your 
   release come out and I’ll keep you updated.
   Do you know when it is released?
 * Thanks Pedro
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF] PHP Fatal error: Uncaught Error: Call to a member function isProcessable()](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-a-member-function-isprocessable/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-a-member-function-isprocessable/#post-17207408)
 * Yes it is still happening and I am up to date.
    -  This reply was modified 2 years, 7 months ago by [mathieu](https://wordpress.org/support/users/mathieu/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF] Avif & Webp not loading on multisite…](https://wordpress.org/support/topic/avif-webp-not-loading-on-multisite/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/avif-webp-not-loading-on-multisite/page/2/#post-17053904)
 * Yes, you nailed it ! So glad, that I can finally remove the hack from my codebase.
 * Thanks a lot Pedro
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF] Avif & Webp not loading on multisite…](https://wordpress.org/support/topic/avif-webp-not-loading-on-multisite/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/avif-webp-not-loading-on-multisite/#post-17041611)
 * Like I told you earlier, I don’t have the proper test environment to try the 
   dev version.
   But if you can notice me when 5.4.2 goes out, I will update it and
   test it thoroughly.
 * Best regards
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF] Avif & Webp not loading on multisite…](https://wordpress.org/support/topic/avif-webp-not-loading-on-multisite/)
 *  Thread Starter [mathieu](https://wordpress.org/support/users/mathieu/)
 * (@mathieu)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/avif-webp-not-loading-on-multisite/#post-17027491)
 * Let me know when you have a new fix. I’ll try it again and keep you updated.
   
   Best regards

Viewing 15 replies - 1 through 15 (of 57 total)

1 [2](https://wordpress.org/support/users/mathieu/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/mathieu/replies/page/3/?output_format=md)
[4](https://wordpress.org/support/users/mathieu/replies/page/4/?output_format=md)
[→](https://wordpress.org/support/users/mathieu/replies/page/2/?output_format=md)