Get field added via attachment_fields_to_edit filter in Gutenberg

Yes, you’re right that the slimImageObject function is the reason why you’re seeing/getting only those limited list of props. But don’t worry, you can use wp.data.select( ‘core’ ).getMedia( <attachment id> ) to get the attribution meta (and any other meta or props in the full attachment object). Here’s an example that worked for me: items.map((item, … Read more

Replace image with its alt text?

You should be able to use the the_content filter for this. Something like this… add_filter( ‘the_content’, ‘wpse418925_replace_images_with_alt’ ); function wpse418925_replace_images_with_alt( $content ) { // If you need to *only* do this on one post, check that we’re in that post. // $desired_post can be an ID, post title, slug, or an array of any of … Read more

Media Library Issues

What you need is a way to scan your uploads directory and register any unregistered files. There are plugins that can help with this. One such plugin is “Add From Server“. This allows you to import media and files into the WordPress uploads manager from the server’s file system. Using this plugin, you can import … Read more

Blurry Images on my Website

Text on images always look blurry when you view it at any other size than 100%. You can try saving them as an svg and using that, then you have to install a plugin that let’s you upload svg’s into your site. Or can make it show text on the image but the images you … Read more

Disable image compression for WebP

It does cover webp as well. From several google pages the default compression was 86. You could also test to confirm by uploading a few with different settings in your functions. This issue on Github shows they changed the default quality to 82. https://github.com/WordPress/performance/issues/563. We can see that webp images use the same quality value … Read more

How to add embed image in comments?

You can do that by using the comment_text filter. It runs for each comment, so with some regex you can find all links in the comment and loop through them. You make one more check to make sure the link has an image extension (jpg, jpeg, png, etc). If it does, we can embed it … Read more