Stop specific file offloading
-
Hi – I am brand new to this and am trying to self teach whilst in lockdown.
I am trying to stop specific files from offloaded by WP Offload Media as they are needed on the server. I am using WP Offload Media Tweaks, but I am new to coding. As in this is my first try…
I need any file that has KEEP in the filename from offloading and it must stay on the server. What I have been trying does not work. Any ideas? The code I tried in the tweaks plugin after lots of internet searching is:
function pre_upload_attachment( $abort, $post_id, $metadata ) {
$file = get_post_meta( $post_id, ‘_wp_attached_file’, true );
$filename = is_string( $file ) ? pathinfo( $file, PATHINFO_FILENAME ) : false;
if ( is_string( $filename ) && in_array( $filename, array( ‘KEEP’ ) ) ) {
$abort = true;
}What am I doing wrong?
Thanx
Andrew
- The topic ‘Stop specific file offloading’ is closed to new replies.