Disable WordPress Big Image Size Scaling

I have the same issue with not being able to turn off big_image_size_threshold (one of the worst new features WordPress has ever put out) for kicks I tried removing the quotes around return false but it doesn’t resolve the issue. The example in Codex does in fact show quotes. https://codex.wordpress.org/Function_Reference/_return_false I have opened a ticket … Read more

Programatically creating image attachments from local URLs and setting featured image

Answers: Is post_guid the image location reference? Or is the path to the image stored somewhere else? $post->guid is the record in a post which holds the URL for your attachment. Where is featured image set? featured image is saved as post meta so use update_post_meta() once you have the attachment id: update_post_meta( $post->ID, ‘_thumbnail_id’, … Read more

Reducing image size in RSS only

It’s very possible, but quite hard to accomplish reliably for all cases (I was working on a plugin for client to do this and more, but sadly the project was never completed). But if you need this for specific blog that you have control over – then task can be simplified with some constrains – … Read more

Is there a way to define a default caption to all uploaded images

There’s really no documentation for it yet, but you’ll probably be able to do it hooking to the attachment_fields_to_save filter and inserting the default caption there. From the Codex: attachment_fields_to_save applied to fields associated with an attachment prior to saving them in the database. Called in the media_upload_form_handler function. Filter function arguments: an array of … Read more

How to disable “insert into post” only when selecting the Featured Image?

You can do this via, add_filter(‘image_send_to_editor’, ‘restrict_images’); function restrict_images($html){ return false; } …now consider the above function primitive, because it will restrict images for all post types. We can modify that on a post_type by post_type basis like so, add_filter(‘image_send_to_editor’, ‘restrict_images’); function restrict_images($html){ // check if its the admin trying to insert image, if so, … Read more

Rename image uploads with width in filename

I’ve managed to do it with the filter image_make_intermediate_size. Probably all the path/filename.extension dismembering and remaking could be optimized or made in a single stroke fashion, but alas, I’ll let that to the reader: // The filter runs when resizing an image to make a thumbnail or intermediate size. add_filter( ‘image_make_intermediate_size’, ‘rename_intermediates_wpse_82193’ ); function rename_intermediates_wpse_82193( … Read more