8
votes
Accepted
Is there a hook which fires after all thumbnails are generated?
Thumbnails in WordPress can be generated by using wp_generate_attachment_metadata(), this function fires a filter after generating all the thumbnails wp_generate_attachment_metadata and the filter ...
8
votes
How To Delete Desired Image Sizes From wp-content/uploads?
That's easy! If you have SSH access, log in and do the following for each size. I am just showing 150x150 size only.
Go to the desired uploads folder via command line.
cd /your-site.com/wp-content/...
8
votes
the_post_thumbnail responsive srcset not populating with custom image size
There's not enough info to be sure this answer is definitive but here's an attempt.
Firstly make sure the image you are uploading is actually larger than the size you have defined. I see people ...
7
votes
How to Delete All regenerated thumbnails but keep the original ones?
If you use WP-CLI then that will automatically delete those sizes that you don't need.
You would run the following command on your server via SSH. You will need to have WP-CLI installed on the server....
6
votes
Accepted
No srcset for hard-cropped thumbnails
To show a srcset, there must be multiple image sizes of the same aspect ratio. When you set your thumbnail to hard crop without creating any other image sizes you are ensuring that there won't be a ...
5
votes
Accepted
Changing playlist shortcode thumbnail sizes?
Demo Plugin - Fixed Size
Here's one suggestion as a demo plugin (PHP 5.4+):
<?php
/* Plugin Name: Custom Playlist Thumb Size */
namespace WPSE238646\PlaylistThumbSize;
add_shortcode( 'playlist',...
3
votes
Accepted
Regenerate thumbnails for images that are not in the media library
wp-content/uploads images wont regenerate if they are not shown in the Media Library because those media ID's needs to be there in the database.You need to first add your images on the media libray ...
3
votes
get_the_post_thumbnail_url with an unregistered size
WordPress does not create any thumbnail on the fly. If you try to fetch a size that doesn't exist, either the closest size or the full size image will be retrieved.
The closest solution you can try ...
3
votes
How can i place Feature Image under title field in wp-admin?
Super late to the party, but well...
If you want to show your featured image right under the Post title in your Admin area, use this piece of code in your functions.php :
add_action('do_meta_boxes', ...
3
votes
Accepted
'Post-thumbnails' feature does not seem to register
Image sizes and cropping settings do not apply retroactively: images that were present on your site before you made this change are not affected.
Your new settings will only apply to images you ...
3
votes
Image Quality Thumbnail Compression in Wordpress?
(this should be a comment, but my reputation is too low)
Setting jpeg_quality will not disable compression because it does not disable processing. JPEGs will be always compressed, and they are almost ...
3
votes
Accepted
get_the_post_thumbnail_url('full') returns empty from custom post type
The first argument for that function is not size. See the documentation (if a function's not working, checking the documentation should always be your first step):
get_the_post_thumbnail_url( int|...
3
votes
Accepted
how to post default thumbnail if post not created yet
Create "images" folder in current active theme the put "dummy-image-1-1.jpg" in that folder.
<?php
if ($the_query->have_posts() ) :
while ($the_query->have_posts()) : $the_query->...
3
votes
Accepted
Why are thumbnails not being generated for PDF files?
I found a solution! I hope this helps save some time and frustration for others that might encounter this problem. It turns out that it isn't WordPress or PHP.
After a lot of digging, I came across ...
3
votes
Accepted
How can I add custom sizes for PDF thumbnails generation?
We have the fallback_intermediate_image_sizes filter within wp_generate_attachment_metadata():
**
* Filters the image sizes generated for non-image mime types.
*
* @since 4.7.0
*
* @param string[...
2
votes
How to disable WordPress from creating thumbnails?
For the latest WordPress with WooCommerce activated plugin use this code:
function add_image_insert_override($sizes){
unset($sizes['thumbnail']);
unset($sizes['medium']);
unset($sizes['...
2
votes
Set custom name for generated thumbnails
You could use the filter image_make_intermediate_size, but you would have to figure out what name you want to change the intermediate file to, according to the $filename you get (and then rename the ...
2
votes
Can I attach a document (eg: PDF) but have a JPEG as a thumbnail?
Good news for this old question, since WordPress 4.7, pdf's thumbnail are automatically generated.
2
votes
Accepted
Store thumbnails and uploads in different directories?
It appears that the thumbnail URLs are generated relatively to the upload folder. So trying to store them outside the uploads folder is not going to be a good idea.
There are hacks to filter the ...
2
votes
Accepted
How to restrict wp generate attachment metadata() to certain intermediate image sizes
wp_generate_attachment_metadata() uses get_intermediate_image_sizes() to get the sizes to work on, which makes them filterable via intermediate_image_sizes.
Additionally, you can filter them after ...
2
votes
Detect if image file is a thumbnail
You need to know your site's current thumbnail dimension settings in order for you to detect if the $url is of thumbnail size.
$thumbnail_width = get_option( 'thumbnail_size_w' );
$thumbnail_height = ...
2
votes
What is the best way to change share image for social networks?
This is actually not related to WordPress and applies to any website or blog:
When an url is shared for the first time on Facebook, it visits the page to grab the title, image, description, etc. and ...
2
votes
Image Quality Thumbnail Compression in Wordpress?
Uninstall the plugin and add this to your functions.php file
add_filter('jpeg_quality', function($arg){return 100;});
add_filter( 'wp_editor_set_quality', function($arg){return 100;} );
However ...
2
votes
Image Quality Thumbnail Compression in Wordpress?
Make sure you convert your images to sRGB before uploading them to WordPress.
Image compression should not dramatically affect the colors and tones of the picture. When you witness a significant ...
2
votes
Accepted
Media Gallery Upload Thumbnail Compression is Changing Image Hue
That is a huge difference!
I think this is your issue...
Any time an image is uploaded, if that image was saved in the Adobe RGB color space, then the image does not get loaded correctly for ...
2
votes
Accepted
Show Post Thumbnail In Custom Post From Other CPT
If you want to get the post thumbnail URL, you can use get_the_post_thumbnail_url():
<?php $image_path = 'images/club/' . $opposition->post_name . '.jpg'; // relative to the root directory
if ( ...
2
votes
Accepted
get taxonomy thumbnail and use it as a variable in code
You have 'taxonomy' => 'product_cat' in your code, so most likely you have Woocommerce, and we need to get a category picture from there.
Try this code
<?php $args = array(
...
2
votes
retrieve thumbnail from post ID of best selling product in category
What I understood from your question is, you want to display the best selling products category image. In that case you need to loop through your product WP_Query .. Like you have wrote and each loop ...
2
votes
Accepted
retrieve thumbnail from post ID of best selling product in category
What I understood from your question is, you want to get the best seller product in each category and set its image as a category thumb.
you will need to loop through all categories then you will ...
2
votes
Accepted
WP is showing wrong image dimensions
How to get real image dimension of already uploaded images which
dimensions are bigger than one now set in media settings?
(Note: The italic and bold formatting above was added by me.)
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
thumbnails × 403images × 146
post-thumbnails × 134
uploads × 27
plugins × 24
php × 24
woocommerce-offtopic × 22
media × 22
media-library × 20
gallery × 18
categories × 17
attachments × 15
custom-post-types × 11
functions × 11
customization × 11
cropping × 11
theme-development × 10
plugin-development × 8
posts × 7
loop × 6
filters × 6
wp-query × 5
custom-field × 5
themes × 5
shortcode × 5