Image optimization for non standard upload path




Wordpress LScache Plugin: Image optimization for non standard upload path

Last Updated on: Wed, 15 Apr 2026 00:00:02
Hi, I have found, that if you change default upload path, then images are not being sent to webp conversion. Can you check that out ? Second thing. It would be great if we could turn lazy loading for certain class or URI, now we can only exclude. Hi, 1) how did you change it ? if the real path and databse record matches, even on non-standard path , it should also get processed 2) duly noted. Best regards, Hi, By this funtion. //Change upload per custom post type function custom_upload_directory( $args ) $unaltered_post_type = array( page, post ) if ( !isset( $_REQUEST[post_type] ) ) if ( isset( $_REQUEST[post] ) ) $post_type = get_post_type( $_REQUEST[post] ) elseif ( isset( $_REQUEST[post_id] ) ) $post_type = get_post_type( $_REQUEST[post_id] ) else $post_type = else $post_type = $_REQUEST[post_type] if ( !empty( $post_type ) && !in_array( $post_type, $unaltered_post_type ) ) //$args[basedir] = str_replace(/wp-less, , $args[basedir]) //$args[baseurl] = str_replace(/wp-less, , $args[baseurl]) $args[path] = $args[basedir] . / . $post_type $args[url] = $args[baseurl] . / . $post_type $args[subdir] = $post_type return $args add_filter( upload_dir, custom_upload_directory ) Expand Hi, you said : then images are not being sent to webp conversion does it mean the images were optimized , but without webp format ? or they dont even get optmed at all ? Best regards, Hi, Sorry its not that. It looks like jpgs which are displayed via img are converted to webp. And those displayed via div + style bg-img, are not. Hi, currently webp replacement only supports 118 Kb original file -> optimized file -> 45 Kb original file -> optimized webp file -> 54 Kb since the webp generator has fixed quality control , you can manually webp them with different parameter if you really really wish to get the webp file for them Best regards, Thx for testing it out.



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference