I think the UPLOADS constant is just some sort of creative writing in the documentation. The code I am (now) looking at is doing:
$dir = ABSPATH . UPLOADS;
So maybe UPLOADS is only to control the suffix. I think you’ll have better luck with this filter:
/**
* Filters the uploads directory data.
*
* @since 2.0.0
*
* @param array $uploads Array of upload directory data with keys of 'path',
* 'url', 'subdir, 'basedir', and 'error'.
*/
$uploads = apply_filters( 'upload_dir', $cache[ $key ] );
It will pass an array, and you would want to try to change $uploads['path']
, I think.
I’ve never looked into this before. You might want to get a second opinion. My point is the uploads path is coming from wp_handle_upload
(and wp_upload_dir
) so I’m not sure it’s a Pressbooks problem, that’s all.
New Idea
Maybe we shouldn’t be storing the fullpath of a file, just the relative path, between steps.