artemsemkin

TranslatePress: use [data-src] data for the images translation

Mar 9th, 2022 (edited)
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.39 KB | None | 0 0
  1. <?php
  2.  
  3. // Use [data-src] data instead of [src] to correctly handle the laza images
  4. add_filter( 'trp_node_accessors', 'trpc_exclude_images_and_links' );
  5. function trpc_exclude_images_and_links( $args ) {
  6.   $args['image_src']['selector'] = 'img[data-src]'; // original selector is 'img[src]'
  7.   $args['image_src']['accessor'] = 'data-src'; // original is accessor is 'src'
  8.  
  9.   return $args;
  10. }
  11.  
Add Comment
Please, Sign In to add comment