How to Removing fields from the Media Uploader/Gallery on a Custom Post Type Edit Page

The current screen doesn’t appear to be set when that filter is run, so you cannot use that. Also, the $post actually refers to the attachment, not the post – so we can’t get the post typ fro that either…. So looking at the source code: http://core.trac.wordpress.org/browser/tags/3.3.2/wp-admin/includes/media.php The filter you are using is called by … Read more

HTTP Error when uploading images

There a couple of different solutions depending on the cause of the problem. In your case it seems that is not a upload problem. I would rather try adding the following plugin <?php /* Plugin Name: Default to GD Plugin URI: http://wordpress.org/extend/plugins/default-to-gd Description: Sets GD as default WP_Image_Editor class. Author: Mike Schroder Version: 1.0 Author … Read more

Removing Image Sizes for Custom Post Type

May be this filter should work intermediate_image_sizes Note: This solution will work if you are uploading an image from post edit screen. (tested on localhost with WP-3.8.1) add_filter( ‘intermediate_image_sizes’, ‘ravs_slider_image_sizes’, 999 ); function ravs_slider_image_sizes( $image_sizes ){ // size for slider $slider_image_sizes = array( ‘your_image_size_1’, ‘your_image_size_2’ ); // for ex: $slider_image_sizes = array( ‘thumbnail’, ‘medium’ ); … Read more

Add a file type

Use filter ‘upload_mimes‘. <?php add_filter(‘upload_mimes’,’add_java_files’); function add_java_files($mimes) { // Add file extension ‘extension’ with mime type ‘mime/type’ $mimes[‘java’] = ‘text/x-java-source’; return $mimes; }

WordPress 3.5+ upload tool filter

The library parameter is actually responsible of what you see in the library frame and not what you can upload. It accepts : image,audio,video,file or any other mime type for example to show only pdf’s : library: { type: ‘application/pdf’ }, Now to actually limit the upload to a file type you need to add … Read more

Looks like image resize is not working well

I’ve had the same issue in the past when uploading very large images. When it comes to crunching the image it fails and shows HTTP ERROR in red. However other images continue to load. It wasnt file size where it would fail but rather the pixel width and height of the images. By default PHP … Read more

Protect Uploads in Multisite

You’ve got some issues in your underlying objective … For example, I have a filed called 40c.jpg located at localhost/files/2011/07/40c.jpg OK, this makes sense and is where the image should be in the first place. I want the file to show up only when called by HTML on the local domain (here: localhost). So not … Read more

wordpress upload http error?

Are you on shared hosting by any chance? Shared hosts tend to limit the max uploadable file size on their end and there is nothing you can add to your scripts to change that. If not, then I am mistaken and this is not the solution you are looking for. However, if you are on … Read more

How to get profile user id when uploading image via media uploader on profile page

You need to pass the $profileuser->ID as the second argument when you call your function and define it accordingly: add_filter(‘wp_handle_upload_prefilter’, ‘my_pre_upload’, 2, 2); // (3rd param is priority, 4th is number of args) // and pass the $userid as argument to your function function my_pre_upload($file, $userid = false){ // if no user specified, get $current_user … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)