Hi @fabriziomazzei, this is currently possible if you place this code somewhere in your template (e.g. functions.php):
/**
* 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)
{
// Skip what's skipped by plugin
if ($is_ignored) {
return true;
}
// Do not skip folders
if (is_dir($full_path)) {
return false;
}
$is_image = in_array(strtolower(pathinfo($full_path, PATHINFO_EXTENSION)), array('jpg', 'jpeg', 'png'));
// $is_image = preg_match("/^.*\.(jpg|jpeg|png)$/i", $file_name) == true;
// Skip if not image
return !$is_image;
}
add_filter('media_sync_filter_is_scan_object_ignored', 'my_custom_media_sync_additional_file_skip', 10, 3);
Not sure about performance, so I also added regex version (commented out). But this should show only jpg, jpeg, and png files.
—
Thanks for the suggestion Simon, but this hook filter already exists, so he doesn’t even need to edit the plugin ??