Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Get thumbnail url of custom meta image?

You’ll have to use different function for that.

wp_get_attachment_url returns a full URI for an attachment file and it doesn’t know what type of attachment it is. It makes no sense to generate thumbnail for .zip od .txt files, so this function doesn’t allow you to get thumbnail url.

On the other hand, wp_get_attachment_image_url knows that the file is an image, so you can tell it which size you want to get:

wp_get_attachment_image_url( int $attachment_id, string|array $size="thumbnail", bool $icon = false )

As you can see, second param is the size:

$size (string|array) (Optional) Image size to retrieve. Accepts any
valid image size, or an array of width and height values in pixels (in
that order).

Default value: ‘thumbnail’

Related Posts:

  1. Is there a hook which fires after all thumbnails are generated?
  2. get_the_post_thumbnail_url with an unregistered size
  3. Cropped featured image replaces original image in gallery
  4. How do I delete all generated images from my server except those currently used in posts
  5. No srcset for hard-cropped thumbnails
  6. Cannot access the thumbnails of attachment images… Cannot find the reason
  7. Removing Title Tag from Thumbnails
  8. Regenerate missing _wp_attachment_metadata
  9. How to make programmatic image upload generate thumbnail and sizes?
  10. Disable wordpress image sizes generation
  11. WP 3.4 has missing photo data
  12. Display latest 12 images from media library
  13. Image Quality Thumbnail Compression in WordPress?
  14. Lazyload post thumbnails
  15. Retrieving an alt tag from a custom field
  16. Show full image thumbnail
  17. Image thumbnails not available post migration, but still accessible via direct URL – DB issue
  18. Upload media files to Amazon S3
  19. Dynamic tagged image galleries
  20. How to stop thumbnail generation from some images and different size thumbnail generate
  21. Update old Post image metadata to ‘thumbnail’ wp_attached_file
  22. How to stop wordpress always displaying full-res images
  23. Fixing image names for a site being restored
  24. force feed readers to pick atom version
  25. How to make thumbnails of uploaded animated gifs NOT animated
  26. Gallery with thumbnail carousel
  27. Is it possible to change image size used for preview thumnail in Add Media popup
  28. Generate images to be associated for tag and category?
  29. Display an icon with get_post_meta?
  30. Filter for post_thumbnail: link to small src and add data-attribute [duplicate]
  31. Dynamic image crop in WP 3.0+?
  32. Remove “%” from strings in serialized arrays in wp_postmeta
  33. How do I get a smaller size of an avatar image
  34. Why WordPress suddenly changed sizes of thumbnails?
  35. Stop WordPress compressing images? – Quality is terrible
  36. Rebuild thumbnails via WP Cli – how?
  37. Can we use featured image as third party website image URL
  38. Get an image from url, resize it, and save on a custom folder (not the media library)
  39. add_image_size not working
  40. Disable Media File Image Link On Mobile Devices
  41. Product Images Low Quality After Updating From WP 3.5 to 4 [closed]
  42. adding image to post thumbnail from another server
  43. Image not showing using a custom function and get_post_meta
  44. How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?
  45. Broken thumbnails (sometimes) with TimThumb
  46. Is it possible to save crop to a different size of the image when in image editor?
  47. how to change format jpg to webp?
  48. How to join Caption AND Description Meta Fields as one combined-caption in Image Block
  49. Apply manual image cropping not to thumbnail but medium_large size
  50. Images not showing after wordpres update 5.6
  51. how to regenerate webp et-pb-portfolio-image
  52. How to use default image as featured image by implement some code in function.php
  53. Auto Generate Thumbnail
  54. WordPress Multisite: Images moved to /sites/1?
  55. How to Display Image Caption but Not Alt Text
  56. unsharp thumbnails after uploading image
  57. ADD class to all my images (thumbail)
  58. When upload a PNG a noise appears in the thumbnails
  59. I cannot upload images to post or the media library in wordpress
  60. Why image Thumbnail url is not displaying with custom size?
  61. Blank image thumbnails in media library
  62. How to disable post-thumbnail from generation?
  63. New portfolio items appearing smaller on the grid
  64. WordPress can’t detect any thumbnails size?
  65. WooCommerce Variation Swatches and Photos – get attribute thumbnail
  66. get_post_meta returning broken path in image src
  67. Image thumbnail on single product issue | WooCommerce
  68. How Do I Auto Generate Thumbnail from First Embedded Image?
  69. Why doesn’t WordPress make thumbnails for videos?
  70. Adding Image Description below Images Inserted into Posts
  71. Create a custom attachment thumbnail for quick page load
  72. Why are my ‘medium’ images the wrong size
  73. Making a thumbnail if there exist a link with. jpg or .png extension in WordPress
  74. Imagem resolution responsive
  75. Add custom version to an image
  76. get_post_custom: get image URL instead of image ID
  77. WP is showing wrong image dimensions
  78. How to include featured image on blog post preview?
  79. Thumbnail size keeps resetting automatically
  80. Delete all thumbnails & regenerate them?
  81. Media Library shows default image instead of image preview
  82. Trying WP editor to load full size image (not ‘300×300’)
  83. Why are PDF thumbnails over-saturated?
  84. Why should I use “Organize my uploads into month- and year-based folders” option? (Cons/Pros)
  85. Upload .doc to blog
  86. An error has occurred during the upload process in wordpress version 5.3.2
  87. Thumb doubles the image file size
  88. Featured Image metabox lost
  89. I tried to move the featured image below the paragraphs but now it is displaying twice
  90. How To Showcase High Quality Images On WordPress Website?
  91. How to have the frontend show the appropriate image size?
  92. Random images from uploads folder and subfolder
  93. Generate / attach Image srcsets from ACF Image Field
  94. Is there a way to upscale a media library original image to the nearest whole pixel in WordPress?
  95. How to make Media Library files private?
  96. How to add embed image in comments?
  97. Copy Content with Images to Other Site
  98. Changing Theme produced a problem on some pages
  99. wp_get_attachment_image with custom size not rendering possible 2x srcset image
  100. How do I link an image in a svg file in wordpress?
Categories images Tags images, post-meta, thumbnails
Change the category of all posts in it
need to exclude APP_TAX_STORE => $term->slug

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress