Hi @aparentdesign, if you want to skip only if it’s retina and a thumbnail, you can try adding this hook to functions.php of your template for example:
/**
* Overwrite Media Sync plugin rules for skipping scanned files or folders.
*
* Should return bool value.
*
* @param boolean $is_ignored Default rules for this file/folder (skipping thumbnails, index.php, hidden files, etc.)
* @param string $full_path Each scanned file/folder absolute path
* @param string $file_name Each scanned file/folder name
* @return boolean
*/
function my_custom_media_sync_additional_file_skip($is_ignored, $full_path, $file_name)
{
// Solution #1:
// If "@2x" or "@3x" are anywhere in file name (not necessarily at the end)
// $is_this_retina_file = strpos($file_name, '@2x') !== false || strpos($file_name, '@3x') !== false;
// Solution #2:
// Any retina image (e.g. "@2x.jpg", "@3x.jpg", "@4x.jpg"...)
// $is_this_retina_file = preg_match('/@[2-9]x(?=\.[a-z]{3,4}$)/im', $file_name) == true;
// Solution #3:
// Retina thumbnail image (e.g. "[email protected]", "[email protected]", "[email protected]"...)
$is_this_retina_file = preg_match('/[_-]\d+x\d+@[2-9]x(?=\.[a-z]{3,4}$)/im', $file_name) == true;
return $is_ignored || $is_this_retina_file;
}
add_filter('media_sync_filter_is_scan_object_ignored', 'my_custom_media_sync_additional_file_skip', 10, 3);
Or if you want to skip any retina image, you can uncomment code for “Solution #2” and comment out “Solution #3” in the example above.
Thanks for the feedback, I might make this configurable in plugin settings one day.
Erol