How to make my site use HTTPS for images or how to insert images as relative paths?

Main Issue As long as you are accessing the WordPress dashboard via HTTPS, new media items should be inserted into content using HTTPS in the associated media item URL. There is a bit more detail around that feature in this WordPress ticket: wp_get_attachment_url returns https when it should not. That ticket describes how wp_get_attachment_url returns … Read more

Conflict with single and double quotes

It’s sometimes easier to work with sprintf(): ‘Default’ => sprintf( ‘<img src=”https://wordpress.stackexchange.com/questions/213508/%s/admin/images/default.png” width=”120″ height=”80″ alt=”%s” />’, get_template_directory(), esc_attr__( ‘Default’, ‘my_theme’ ) ); where we use the esc_attr__() to return a translated value that’s safe to be used in an attribute, but I’m not sure what your THEMEROOT contains, so I just replaced it with get_template_directory().

One of my image sizes isn’t showing up in srcset

Just gong to post the answer here too. @Dan linked to another question that had the answer. Here’s some documentation on the new responsive images feature: Responsive Images in WordPress 4.4 The default max-size that will go into a srcset is 1600px wide. So if you plan on using images that are bigger than that, … Read more

How to get image from media library with URL [duplicate]

I believe you will need this function: wp_get_attachment_image_src(); (Here is the codex link: https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/) All you have to do is pass in the ID of the image you wish to fetch and it will give you the URL. A little example: <?php // Getting the media attached to a post $post_image_url = wp_get_attachment_image_src($post->ID); // var_dump … Read more

Modify RSS – remove image and add text

Note that the_permalink_rss() and the_excerpt_rss() do echo the output, not return it. With your current snippet, replace the_excerpt_rss() with: apply_filters( ‘the_excerpt_rss’, get_the_excerpt() ); and replace the_permalink_rss() with: esc_url( apply_filters( ‘the_permalink_rss’, get_permalink() ) ); You could also use: <content:encoded><![CDATA[ <?php the_excerpt_rss(); ?> <a href=”https://wordpress.stackexchange.com/questions/245310/<?php the_permalink_rss(); ?>”> <?php esc_html_e( ‘Read more’, ‘mydomain’ );?> </a> <?php esc_html_e( ‘at’, … Read more

Media gallery images url instead of ID on WP API Response

This is the correct way to achieve it is this: function show_main_image($object, $field_name, $request){ $custom_fields = get_post_custom($object[‘id’]); $main_image = $custom_fields[‘main_image’]; $arregloimg = explode(‘,’,$main_image[0]); $image_urls = array(); foreach ( $arregloimg as $key => $value ) { $image_urls[] = wp_get_attachment_url($value,’thumbnail’); }; return $image_urls; }

How to fix a missing image

The code of your site shows that the HTML is referencing your developer’s server for the logo. They must have cleaned up and deleted that server installation recently. You’ll need to re-upload a logo to your own media library.