Hi @jon1wt,
Thank you for your message.
What exactly filters do you use? Does the path given in the error message exist? If not, what is the correct one?
Thread Starter
Jon
(@jon1wt)
Hi @mateuszgbiorczyk
I am using this filter
add_filter ('webpc_uploads_webp', function ($ path) {
return 'wp-content/uploads';
});
and I have not modified it since the first time I installed the plugin, the path should be the same, what I see in the message is it has double // before the wp-content
-
This reply was modified 5 years, 9 months ago by
Jon.
Please add the following code to your theme:
<?php
add_action('init', function()
{
echo '<pre>';
print_r([
'webpc_uploads_root' => apply_filters('webpc_uploads_root', ABSPATH),
'webpc_uploads_path' => apply_filters('webpc_uploads_path', ''),
'_webpc_uploads_path' => apply_filters('webpc_uploads_path', '', true),
'webpc_uploads_webp' => apply_filters('webpc_uploads_webp', ''),
'_webpc_uploads_webp' => apply_filters('webpc_uploads_webp', '', true),
]);
echo '</pre>';
exit;
});
Please send me what is displayed to you. Please also go to FTP, the /wp-content directory and take a screenshot so that I can see the directory structure and current path.
Thread Starter
Jon
(@jon1wt)
The code display this
Array
(
[webpc_uploads_root] => /var/www/html/
[webpc_uploads_path] => /var/www/html//wp-content/uploads
[_webpc_uploads_path] => wp-content/uploads
[webpc_uploads_webp] => /var/www/html//wp-content/uploads
[_webpc_uploads_webp] => wp-content/uploads
)
the reason i need the files to be in the same directory is because they are sent to a s3 bucket
this is a screenshot of last month’s folder and you can see a file and the webp version
screenshot
Try using the webpc_uploads_root filter to set the correct path. Are the files in the media library on the same server as the other website files?
Thread Starter
Jon
(@jon1wt)
I am going to try the filter you are commenting on, is the same function just change the name or do I need to use both filters?
about the files, the website files are separated, the bucket is only for the uploads folder
This filter applies to both /uploads and /uploads-webpc. Try using only this filter. Using the webpc_uploads_webp filter, you cannot set the same path as the original files. It is impossible.
Thread Starter
Jon
(@jon1wt)
I’m still trying to get it working but still can’t make it, I use the filter like this example
add_filter('webpc_uploads_root', function($path) {
return 'n';
});
but create the “n” folder inside the wp-admin folder
Any ideas how I could make webp files create inside the “wp-content/uploads” folder along with the original files?
You provide the full server path in this filter. You cannot choose the same folder for WebP files as for /uploads.