Put the media uploader in a metabox
As Apple might’ve put it “There’s a plugin for that” 🙂 (Faster Image Insert)
As Apple might’ve put it “There’s a plugin for that” 🙂 (Faster Image Insert)
You can add inputs and fields to attachments by hooking into attachment_fields_to_edit. This will add fields to both the modal as well as the attachment editor. The catch I found is that WordPress (if anyone has experienced differently PLMK) doesn’t save the extra fields data so you have to hook into a couple other items. … Read more
In your answer you said that desired path is something like wp-content\uploads\state-name\destination\ where state-name is a taxonomy term and destination is the slug of one destination CPT. Last thing is not clear from your question, but it seems so, let me know if I’m wrong). So, I suggest you this workflow: Add a destination post … Read more
You want media_handle_sideload() Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload(). // Array similar to a $_FILES upload array. $file_array = array( ‘name’ => ‘filename.jpg’, ‘tmp_name’ => ‘path/to/filename.jpg’, ); // Post ID to attach upload to, 0 for none. $post_id = 0; $attachment_id = media_handle_sideload( $file_array, $post_id … Read more
Include this small plugin, activate and test. A tested version in 3.6-alpha, works only on click on a thumbnail. <?php /** * Plugin Name: Remove Attachment Link-To and set to value ‘none’ */ add_action( ‘admin_footer-post-new.php’, ‘wpse_76214_script’ ); add_action( ‘admin_footer-post.php’, ‘wpse_76214_script’ ); function wpse_76214_script() { ?> <script type=”text/javascript”> jQuery(document).ready( function($) { $( ‘li.attachment’ ).live( ‘click’, function( … Read more
is there a way to update all media urls in wordpress I had a similar issue with my media files not having the correct file location after a WordPress upgrade (somehow all the media links switched to a crazy incorrect directory), so I found Upload URL and Path Enabler which was able to rewrite all … Read more
To summarize the discussion in the comments, the answer for the question as it is asked is that it is not possible. The web standards as they are right now do not have a facility to declare a favicon for PDF files, only for the whole domain via the favicon.ico file. You can try to … Read more
As Rarst has explained, you can’t really directly edit your database, or you’ll risk killing the serialized data. Your options are thus to: delete the file and re-upload it with its new name (obviously has the downside of having to reinsert it everywhere it was being used), or to use one of the media renaming … Read more
Exactly the same code as Mridul, but different filter: function wp_70048_remove_image_sizes($sizes) { unset($sizes[‘thumbnail’]); unset($sizes[‘medium’]); unset($sizes[‘large’]); return $sizes; } add_filter(‘image_size_names_choose’, ‘wp_70048_remove_image_sizes’); Tested with WP 3.4.2
You could do this by filtering the meta value for _thumbnail_id. add_filter( ‘update_post_metadata’, ‘generate_featured_image_sizes’, 10, 5 ); add_filter( ‘add_post_metadata’, ‘generate_featured_image_sizes’, 10, 5 ); function generate_featured_image_sizes( $check, $object_id, $meta_key, $meta_value, $unique_or_prev ) { if ( $meta_key == ‘_thumbnail_id’ ) { // regenerate previous featured image thumbs if it exists if ( false !== ( $prev_thumb_id = … Read more