How to disable drag-and-drop upload function in Media Library?

Instead of removing upload script you can make the upload error out if the user does not have admin privileges. Like this- function tomjn_only_upload_for_admin( $file ) { if ( ! current_user_can( ‘manage_options’ ) ) { $file[‘error’] = ‘You can\’t upload images without admin privileges!’; } return $file; } add_filter( ‘wp_handle_upload_prefilter’, ‘tomjn_only_upload_for_admin’ ); For other possible … Read more

Can’t upload CSV file to plugin directory using custom upload form in admin panel

I don’t know what the reason you upload a file to the plugin directory. The standard way to upload a file is to the WordPress uploads directory. In your code, I find this one is wrong $uploadPath = $currentDir . $uploadDirectory . basename($fileName); See, you merge two path together. Try $uploadPath = $uploadDirectory . basename($fileName); … Read more

how to change wp upload directory to another domain directory

Well, what you want to achieve saving uploads in another domain? You want to share the uploads folder with another domain? Did you know you can use more than one domain (site) in a single WordPress Installation? It’s called Multisite: https://premium.wpmudev.org/blog/ultimate-guide-multisite/ To change the upload dir. Just use the filter upload_dir. It’s documented here: https://codex.wordpress.org/Plugin_API/Filter_Reference/upload_dir … Read more