
How to disable srcset in wordpress
Starting from version 4.4 in WordPress, the default parameter is embedded srcset which allows you to adapt the pictures that are directly in the template. But as practice has shown, Google PageSpeed Insights doesn't recognize this parameter correctly and lowers the page load quality.. Most likely, this is related to, that not all mobile devices have already learned to support this format. If at the time of reading this article you are experiencing the same problems, I recommend trying to disable this setting.
Disabling srcset in WordPress is very easy, you need to go to your theme directory /wp-content/themes/{your-theme}/functions.php and write a special filter in this file. I am posting an example below..
1 2 3 4 5 | function meks_disable_srcset( $sources ) { return false; } add_filter( 'wp_calculate_image_srcset', 'meks_disable_srcset' ); |
That's all there is to it. If you want to read what google says about the srcset attribute, go and read here. If anyone finds information, how to improve this setting with PageSpeed, write in the comments, I will be happy with new information and ready to redo the article.

/*

- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.