Hi @suryamaya,
Thank you for your message.
Please provide an example of the path you would like to exclude and an example of the path from which you would like to convert images.
Best,
Mateusz
Thank you @mateuszgbiorczyk for your response.
When I enabled the plugin it only works for main site “abc.com” but not for other sites”mysite1.com, mysite2.com”. Please be advised that the same database is shared between all three sites. Basically if webP works for other two sites “mysite1.com, mysite2.com” that would be great. Please advise if that is possible.
However if that is not possible the folders that I would like to exclude are as listed below:
1. public_html/mysite1/wp-content/uploads
2. public_html/mysite2/wp-content/uploads
Thanks
@suryamaya By default, in the case of WordPress Multisite, we have the same directory for all sites. We have one /wp-content directory and one WordPress root directory.
However, in the /wp-content/uploads/ directory we are divided into directories for different sites. That’s why I asked you to provide real paths, not examples.
@suryamaya Our plugin is compatible with WordPress Multisite, but in my opinion this is not a Multisite Network. By default, image URLs at Multisite have the following URL:
/wp-content/uploads/sites/1/2024/04/example-image.png
Your URLs look like this:
/wp-content/uploads/2024/04/example-image.png
Please describe to me in detail how your websites are connected to each other from a technical point of view. It’s very important that I can help you.
Hi @mateuszgbiorczyk
This is not the multisite as you said. The two of the later sites share the database from the main site. The NZ an UK sites are in one folder and main site in one folder. Hope this helps.
Please let me know if you have any questions.
@suryamaya How is it structured from a technical perspective?
Hi @mateuszgbiorczyk,
We just change the url while vising the UK and NZ sites. When we upload the images on main site they are again copied to the respective uploads folder of these sites. Does this help?
@suryamaya What about content and images in the /uploads directory? Are they identical?
@suryamaya But the WordPress files are different – for each site you have separate WordPress files, plugins and so on?
@mateuszgbiorczyk Like I mentioned main site has one wp set up (files, plugins etc) and other two have one wp set up, just the files and plugins and they are copy of the main site but in a different folder.
Not sure if your exclusion feature works on this case. Please advise.
@suryamaya I have never tested such a case. You can just check it out. If you exclude a directory, after saving the changes it will disappear from the Bulk Optimization of Images section.
@mateuszgbiorczyk Sure I will try. You have provided the example of the image. Can we exclude the folder as well like the uploads/2024?
@suryamaya In the Advanced Settings tab you can exclude directories, or you can use the filter below to be more specific:
add_filter( 'webpc_supported_source_directory', function( bool $status, string $directory_name, string $server_path ): bool {
$excluded_directories = [ 'my-directory' ];
if ( in_array( $directory_name, $excluded_directories ) ) {
return false;
}
return $status;
}, 10, 3 );
Please note the $server_path variable – you can modify this filter code to use this variable.