SSL: How to make customizer images Protocol Relative in WordPress?

I think the simpler solution would be to create your own function: function get_theme_mod_img($mod_name){ return str_replace(array(‘http:’, ‘https:’), ”, get_theme_mod($mod_name)); } then just use it: <a href=”https://wordpress.stackexchange.com/questions/256864/<?php echo esc_url(get_theme_mod(“slide_one_link’)); ?>”><img src=”<?php echo esc_url( get_theme_mod_img( ‘slide_img_upload_one’ ) ); ?>” alt=”<?php echo get_theme_mod( ‘slide_title_1’ ); ?>” /></a> there is another solution that involve filters as you can see … Read more

Why is wordpress searching for @2x images?

Despite having no plugins installed through wordpress, I did have retina.min.js being enqueued in my functions.php file from the template I downloaded. Retina.min.js (source: http://imulus.github.io/retinajs/) looks for high resolution versions (denoted with suffix @2x right before the extension) of each image in your site and attempts to replace them if any are found. Since I … Read more

Image file sizes increasing on upload

OK I seem to have found the answer to this. The theme I’m using has Aqua Resizer installed. Quality was set to 100% which for some reason made the resized versions bigger in file size. I’ve changed the quality setting to 80 and it has sorted it.

Passing srcset to image attachment method

I can’t say I’ve tested this but here’s what you could to, it should in theory work. The wp_get_attachment_image() functions 4th parameter is an array of attributes. You should be able to pass what you get returned from wp_get_attachment_image_srcset() to the attribute parameter as follows, sort of similar to the example seen on the docs. … Read more

How to get CMB2 to show a single image at a specific size

You can get ID of the attachment, and then use that to get whichever size you need. https://github.com/CMB2/CMB2/wiki/Field-Types#file A file uploader. By default it will store the file url and allow either attachments or URLs. This field type will also store the attachment ID (useful for getting different image sizes). It will store it in … Read more

Upload thousands of images to WordPress without plugin?

I’ve modified method wp_update_attachment_metadata from wp-includes/post.php (line 5070) to this, just during the Import: /** * Update metadata for an attachment. * * @since 2.1.0 * * @param int $attachment_id Attachment post ID. * @param array $data Attachment meta data. * @return int|bool False if $post is invalid. */ function wp_update_attachment_metadata( $attachment_id, $data ) { … Read more

How to disable the suffix “-scaled” which is being added at the end of each uploaded image?

How to disable this behaviour? Add this to your functions.php: add_filter( ‘big_image_size_threshold’, ‘__return_false’ ); How does it work? When a new image is uploaded, WordPress will detect if it is a “big” image by checking if its height or width exceeds the big_image threshold. The default threshold value is 2560px, filterable with the new big_image_size_threshold … Read more