Hi @taisa1984, I just pushed a new version (1.1.3) which accepts custom hook function to overwrite or improve which files are ignored.
I wrote an example that you can add to your theme’s functions.php file or wherever it works for you.
And your regex will actually skip all files containing “webp” text, so not just as an extension. And I guess you also don’t want to skip actual .webp files, but only those which are optimized (e.g. .jpg.webp). So I tweaked that regex a bit ??
/**
* Overwrite Media Sync plugin rules for skipping scanned files or folders.
*
* File/folder contains:
* $fileOrFolder->getFilename()
* $fileOrFolder->getPathname())
* $fileOrFolder->isDir())
*
* Should return bool value.
*
* @param boolean $is_ignored Default rules for this file/folder (skipping thumbnails, index.php, hidden files, etc.)
* @param RecursiveDirectoryIterator $fileOrFolder Each scanned file/folder
* @return boolean
*/
function my_custom_media_sync_additional_file_skip($is_ignored, $fileOrFolder)
{
$name = $fileOrFolder->getFilename();
// Check if it is optimized .webp file
$is_optimized_webp = preg_match('/.[a-z]{3,4}.webp/i', $file_name) == true;
// Already ignored files or webp
return $is_ignored || $is_optimized_webp;
}
add_filter('media_sync_filter_is_scan_object_ignored', 'my_custom_media_sync_additional_file_skip', 10, 3);
Hope this will help until there are proper options for this. Please let me know if it works ??
Thanks
Erol