@@ -340,28 +340,27 @@ public function filter_out_local( $content ) {
340340 // Replace old tag.
341341 $ new_tag = str_replace ( $ url , $ cloudinary_url , $ asset );
342342
343- // Check if there is a class set. ( for srcset images in case of a manual url added ).
344- if ( false === strpos ( $ new_tag , ' class= ' ) && ! is_admin () ) {
345- // Add in the class name.
346- $ new_tag = str_replace ( '/> ' , ' class="wp-image- ' . $ attachment_id . '"/> ' , $ new_tag );
347- }
348-
349- // Apply lazy loading attribute
350- if ( apply_filters ( 'wp_lazy_loading_enabled ' , true ) && false === strpos ( $ new_tag , 'loading="lazy" ' ) ) {
351- $ new_tag = str_replace ( '/> ' , ' loading="lazy" /> ' , $ new_tag );
352- }
343+ // Add front end features.
344+ if ( ! is_admin () ) {
345+ // Check if there is a class set. ( for srcset images in case of a manual url added ).
346+ if ( false === strpos ( $ new_tag , ' class= ' ) ) {
347+ // Add in the class name.
348+ $ new_tag = str_replace ( '/> ' , ' class="wp-image- ' . $ attachment_id . '"/> ' , $ new_tag );
349+ }
350+ // Apply lazy loading attribute
351+ if ( apply_filters ( 'wp_lazy_loading_enabled ' , true ) && false === strpos ( $ new_tag , 'loading="lazy" ' ) ) {
352+ $ new_tag = str_replace ( '/> ' , ' loading="lazy" /> ' , $ new_tag );
353+ }
353354
354- // If Cloudinary player is active, this is replaced there.
355- if ( ! $ this ->media ->video ->player_enabled () ) {
356- $ poster = $ this ->get_poster_from_tag ( $ asset );
357- if ( false !== $ poster ) {
358- $ post_attachment_id = $ this ->media ->get_id_from_url ( $ poster );
359- $ cloudinary_url = $ this ->media ->cloudinary_url ( $ post_attachment_id );
360- $ new_tag = str_replace ( $ poster , $ cloudinary_url , $ new_tag );
355+ // If Cloudinary player is active, this is replaced there.
356+ if ( ! $ this ->media ->video ->player_enabled () ) {
357+ $ poster = $ this ->get_poster_from_tag ( $ asset );
358+ if ( false !== $ poster ) {
359+ $ post_attachment_id = $ this ->media ->get_id_from_url ( $ poster );
360+ $ cloudinary_url = $ this ->media ->cloudinary_url ( $ post_attachment_id );
361+ $ new_tag = str_replace ( $ poster , $ cloudinary_url , $ new_tag );
362+ }
361363 }
362- }
363- // Add srcset on front end.
364- if ( ! is_admin () ) {
365364 $ image_meta = wp_get_attachment_metadata ( $ attachment_id );
366365 $ image_meta ['file ' ] = pathinfo ( $ cloudinary_id , PATHINFO_FILENAME ) . '/ ' . pathinfo ( $ cloudinary_id , PATHINFO_BASENAME );
367366 $ image_meta ['overwrite_transformations ' ] = $ overwrite_transformations ;
0 commit comments