Different upload path per file type

Change upload directory for PDF Files seems to be a good stepping stone forward. Although untested, looking at the code my adaptation would be along the lines of… <?php add_filter(‘wp_handle_upload_prefilter’, ‘custom_media_library_pre_upload’); add_filter(‘wp_handle_upload’, ‘custom_media_library_post_upload’); function custom_media_library_pre_upload($file){ add_filter(‘upload_dir’, ‘custom_media_library_custom_upload_dir’); return $file; } function custom_media_library_post_upload($fileinfo){ remove_filter(‘upload_dir’, ‘custom_media_library_custom_upload_dir’); return $fileinfo; } function custom_media_library_custom_upload_dir($path){ $extension = substr(strrchr($_POST[‘name’],’.’),1); if ( !empty( … Read more

Disable mouse image resizing in editor

I use a lot of CSS to manipulate things in the WP UI. I have this in a plugin – should work as expected. If you are already hooked into the admin CSS then bypass the filter. PHP add_filter (‘admin_enqueue_scripts’, array(&$this, ‘load_custom_wp_admin_style’ )); function load_custom_wp_admin_style() { echo ‘<style type=”text/css” rel=”stylesheet-default-admin”> @import url(‘.WPMSGC_URL.’/assets/css/default-admin.css);’ . $this->options[‘default_admin_css’] . … Read more

How To install AWS SDK for PHP in wordpress?

Install Amazon Web Services Plugin. (https://wordpress.org/plugins/amazon-web-services/) Add all the required keys, at the AWS menu that now should be available in your WP dashboard. Include the library in your code, in my case was: require ‘/path/to/plugins/amazon-web-services/vendor/aws/aws-autoloader.php’; Enjoy!

WP Media uploader loading only once in options page

The reason for the media uploader not opening when clicking the second button is that both of your buttons have the same ID, which you are also binding to the function that open your uploader. Element IDs should always be unique, hence the .click function listener will only detect when user clicks the first button … Read more