admin管理员组文章数量:1317909
We have a folder of secure files which are currently PW protected through htpassword with NGNIX.
Those files are currently inside the/wp-content/uploads/
directory /wp-content/uploads/secure-files/
.
This works fine as the files are not accessible publicly, but the media library is prompting admins who utilize the media library for the PW and username as i assume the application is requesting the media from the secured URL and is trying to build the thumbnail with it. This is a massive inconvenience, as when this system was built, this prompt while using the media library never happened -- only when you manually tried to browse to the physical file paths.
The question I am asking, is there a way to modify the default file path so that the files are uploaded to the server, but not shown in the media library? Is there a better way to exclude a particular folder from the /uploads/
directory in WP so that is does not show up in the Media Library? The admins will never have to manage those files through media library so it's ideal if they do not go there. I am simply looking for a solution that exludes a particular folder from the media library, or changes the upload directory so the media library does not see the files.
This is the pseudo code that is being used to modify the upload path for the ACF field.
add_filter('acf/upload_prefilter/key=field_5f10c7212f533', 'my_upload_prefilter');
function my_upload_prefilter($errors) {
add_filter('upload_dir', 'my_change_upload_dir');
return $errors;
}
function my_change_upload_dir($uploads) {
$uploads['path'] = $uploads['basedir'] . '/secure-files/';
$uploads['url'] = $uploads['basedir'] . '/secure-files/';
$uploads['subdir'] = '';
return $uploads;
}
I have also followed the example found here. but the solution is not resulting in the directory being changed to plugin path. I have changed the URL to be a physical path on the server as well but the basedirectory is always /wp-content/uploads/
I assume moving the file upload outside of the normal directory should stop the media library from seeing these files, but I am wondering if there is an easier solution.
本文标签: uploadsPrevent a folder from being shown within the media library
版权声明:本文标题:uploads - Prevent a folder from being shown within the media library 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742027921a2415903.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论