How to use the responsive images feature from WP 4.4 in your themes

Following our exchange in the comments I’ve reread your question and have a pretty straightforward answer: It looks like it’s working fine. You are worried about the sizes attribute in your second example, but it’s the srcset attribute that you should look at and it is showing all of your image sizes: <img src=”http://xxx.dev/wp-content/uploads/Delft_IMG_6275-e1453192498922.jpg” class=”attachment-full … Read more

Apply image width to tag

I am assuming you want this value on the front-end as opposed to needing it in the block editor due to the <figure> somehow not displaying correctly when viewed in the block editor. If that is the case then you can use something similar to DOMDocument as per the following example: Assume HTML of: <div> … Read more

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