How to make WordPress use protocol indepentent upload files?

You can define a function to remove the protocol and hook it to the attachment URL: function wpse_79958_remove_protocol_from_attachment($url) { $url = str_replace(array(‘http:’, ‘https:’), ”, $url); return $url; } add_filter( ‘attachment_link’, ‘wpse_79958_remove_protocol_from_attachment’ ); Also consider to use relative URLs for attachments by using WordPress builtin function wp_make_link_relative: add_filter( ‘attachment_link’, ‘wp_make_link_relative’ ); Place this code to your … Read more

Manipulating Media uploader

what i ended up doing was launching the thickbox uploaded manually via a jquery click event. then with setInterval i was able to hide the pieces i wanted. jQuery(document).ready(function($) { $(‘.specialclass’).click(function() { //get post id from somewhere (for me this was the row column string = $(this).parents(‘tr.type-portfolio’).attr(‘id’); if(/post-(\d+)/.exec(string)[1]) post_id = parseInt(/post-(\d+)/.exec(string)[1], 10); tbframe_interval = setInterval(function() … Read more

Way to force media uploader use custom image size

When calling add_filter( ‘image_size_names_choose’, ‘custom_image_sizes_choose’ ); use your investigative skills to see how it would be best to call an if(thisweretrue) add_filter( ‘image_size_names_choose’, ‘custom_image_sizes_choose’ ); since I don’t know exactly what your specific situation is. I actually was able to use your solution for setting up the custom sizes to help out with what I … Read more

Media Uploader: get deleted files

Without seeing your “list editor” code I can only provide a theoretical answer. when a file is deleted in the media uploader, I also want it removed from the list the user is currently editing, so the files can’t be saved to my custom database table when it no longers exists in the “media environment”. … Read more

Sharding BLOGUPLOADDIR

Copy the body of wp-includes/ms-settings.php into sunrise.php, from line 25 to line 127. At the bottom, add your BLOGUPLOADDIR defines. // from ms-settings.php ms_subdomain_constants(); if ( !isset( $current_site ) || !isset( $current_blog ) ) { // [trimmed, but you need the whole if block] } // end of ms-settings.php copy if ( $current_blog->blog_id < 10 … Read more

upload_mimes filter has no effect

I would use: add_filter( ‘upload_mimes’, ‘theme_restrict_mime_types’ ); function theme_restrict_mime_types( $mime_types ) { $mime_types = array( ‘wif’ => ‘text/plain’, ‘doc|docx’ => ‘application/msword’, ‘jpg|jpeg’ => ‘image/jpeg’, ‘gif’ => ‘image/gif’, ‘png’ => ‘image/png’ ); return $mime_types; } In this example I list all types that I allow (with WIF included). So you would need to add whats missing … Read more