Hi @ateya3d,
Thank you for your message.
Tell me please, did you read the plugin FAQ before you wrote to me? There is information about the webpc_attachment_paths filter that allows you to do what you need. Please remember to check all information about the plugin before adding a thread to the support forum, because very often the solution is available and described.
Here is an example of a filter that you can use on your website (if you have already converted images from this directory, delete them manually):
add_filter('webpc_attachment_paths', function($paths)
{
/* Part of file path - only use slashes instead of backslashes */
$excludedPath = 'wp-content/uploads/2020';
/* Creates pattern that converts one slash from path to one or more slash or backslash chars */
$regexPattern = str_replace('/', '[\\\\\\\\\/]+', $excludedPath);
foreach ($paths as $index => $path) {
if (preg_match('/' . $regexPattern . '/', $path)) {
unset($paths[$index]);
}
}
return $paths;
}, 10, 1);
This filter allows you to check paths before they are passed to WebP conversion, before each conversion. Add this code to the functions.php file in your theme. The given example allows you to exclude all files that are in a given directory (you do not need to specify the entire path, you can specify a part of it).
Test it please and let me know if this solution has helped you.
Hello @ateya3d,
How do you do? Did you solve your problem? If so, let us know, otherwise we will mark the topic as “resolved” within 7 days.
If you have any additional questions, we will be happy to help.
@mateuszgbiorczyk Thanks
Working and solved my problems
many thanks