Ecommerce Shopify WordPress Discussion

WordPress – Adding Dimension to WPRocket Placeholder Doesn't Work

I am trying to set custom lazyload placeholder for WP Rocket. It works fine but when I try to set the size, it doesnt set it, instead it sets its size to original image where lazyload takes place. My code; add_filter( 'rocket_lazyload_placeholder', function( $placeholder ) { $placeholder = get_template_directory_uri().'/assets/images/loader.svg'; return $placeholder; }, 64, 64 ); How WP Rocket handles it; /** * Returns the placeholder for the src attribute * * @since 1.2 * * @param int $width Width of the placeholder image. Default 0. * @param int $height Height of the placeholder image. Default 0. * @return string */ public function getPlaceholder( $width = 0, $height = 0 ) { $width = 0 === $width ? 0 : absint( $width ); $height = 0 === $height ? 0 : absint( $height ); $placeholder = str_replace( ' ', '%20', "data:image/svg+xml,%3Csvg xmlns='' viewBox='0 0 $width $height'%3E%3C/svg%3E" ); /** * Filter the image lazyLoad placeholder on src attribute * * @since 1.1 * * @param string $placeholder Placeholder that will be printed. * @param int $width Placeholder width. * @param int $height Placeholder height. */ return apply_filters( 'rocket_lazyload_placeholder', $placeholder, $width, $height ); } Example output; <img fetchpriority="high" decoding="async" width="300" height="215" src="#LOADER_URL#" class="attachment-300x215 size-300x215 wp-post-image" alt="" data-lazy-src="##ACTUAL_IMAGE##"> Until the actual Image loaded I need width and height to be 64px. Is there anything I am missing? Thanks in advance!
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.