• Resolved suryamaya

    (@suryamaya)


    Hi there,

    We have website abc.com and there another few sites (mysite1.com, mysite2.com) that share the same database as abc.com. When I activated the plugin it works on abc.com but not on mysite1.com, mysite2.com. All the sites are on the same hosting and within the same account.

    I tried “webpc_supported_source_directory” filter adding the directory where those sites are. abc.com is in public_html and other sites are in different directory say mysite1 and mysite2. But the filter didn’t work. Is there a way to exclude the images of mysite1.com and mysite2.com?

    Thanks

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    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

    Thread Starter suryamaya

    (@suryamaya)

    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

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @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.

    Thread Starter suryamaya

    (@suryamaya)

    Hi @mateuszgbiorczyk

    Here are site links:
    Main site: https://cruise-croatia.com.au/
    Sites that share the same database: https://cruise-croatia-and-beyond.co.nz/
    https://cruise-croatia-and-beyond.co.uk/

    Does this help?

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @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.

    Thread Starter suryamaya

    (@suryamaya)

    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.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @suryamaya How is it structured from a technical perspective?

    Thread Starter suryamaya

    (@suryamaya)

    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?

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @suryamaya What about content and images in the /uploads directory? Are they identical?

    Thread Starter suryamaya

    (@suryamaya)

    @mateuszgbiorczyk yes they are.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @suryamaya But the WordPress files are different – for each site you have separate WordPress files, plugins and so on?

    Thread Starter suryamaya

    (@suryamaya)

    @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.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @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.

    Thread Starter suryamaya

    (@suryamaya)

    @mateuszgbiorczyk Sure I will try. You have provided the example of the image. Can we exclude the folder as well like the uploads/2024?

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @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.

Viewing 15 replies - 1 through 15 (of 17 total)

The topic ‘Exclude folder on different domain sharing same database’ is closed to new replies.