There’s been a change to the media_sync_filter_is_scan_object_ignored
filter, so the new examples should look like this:
/**
* 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)
{
// Get path info
$file_path_parts = pathinfo(wp_normalize_path($full_path));
// Get each file without extension
$file_without_extension = $file_path_parts['dirname'] . '/'. $file_path_parts['filename'];
// If .pdf file pair exists for this file, we'll consider this file to be a PDF thumbnail
$is_this_pdf_thumbnail = file_exists($file_without_extension . '.pdf');
return $is_ignored || $is_this_pdf_thumbnail;
}
add_filter('media_sync_filter_is_scan_object_ignored', 'my_custom_media_sync_additional_file_skip', 10, 3);
/**
* 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)
{
$is_this_pdf_thumbnail = strpos($file_name, '-pdf.jpg') !== false;
return $is_ignored || $is_this_pdf_thumbnail;
}
add_filter('media_sync_filter_is_scan_object_ignored', 'my_custom_media_sync_additional_file_skip', 10, 3);
Should have updated this topic before that change, and these filters should be documented somewhere.