Linked Questions

4 votes
1 answer

Get Attachment ID from URL [duplicate]

I have the URL of an image which I know is an attachment. Now, I need to find out the attachment ID. This is what I've got (thanks to PippinsPlugins): // retrieves the attachment ID from the file ...
websupporter's user avatar
  • 2,919
8 votes
6 answers

How do I get attachment_id?

This is trivial, but I can't really find an answer, I've seen some hints like search in database etc., but this is madness. Basically, I have a metabox with upload button that allows you to upload or ...
Wordpressor's user avatar
  • 5,011
2 votes
2 answers

Get attachment id from WP Customizer

The WP Customizer's WP_Customize_Image_Control returns the attachment's URL, but I need the ID because I want to output the image like this: echo wp_get_attachment_image( $user_logo_id, 'riiskit-user-...
chrisriis's user avatar
17 votes
3 answers

Handle issues with change of image scaling (rounding) in 4.1 (WP Ticket #18532)

I am currently in the course of migrating site content from an old pre 4.1 site to a new setup and hitting an issue with the rounding error issue of #18532 and the corresponding fix. To summarize this ...
kraftner's user avatar
  • 5,590
2 votes
1 answer

Set featured image using URL with wp rest api

I'm using wordpress REST API for sending posts. I uploaded the media already on the wordpress and i have the urls, now I want while sending the post request for creating a post, i could give it the ...
Amirition's user avatar
  • 345
3 votes
3 answers

Reducing image size in RSS only

Is it possible to reduce the image size of WordPress rss feeds parse to feedburner? Meaning to say I still want to retain the large image size on the original post page but only display the ...
Laurent Ho's user avatar
0 votes
2 answers

If file exists with page slug name show image else nothing

I need to add a php code in a wordpress widget called PHP Code Widget which only asks for proper enclosing: All PHP code must be enclosed in the standard php opening and closing tags ( <?php and ?&...
Zacocom Zaccom's user avatar
0 votes
2 answers

Retrive images from the_content()

I would like to get the images from the_content(), I know I could use a regex to get the images but I wanted to know if there is any other more 'wordpress way' for doing this? I have this within a ...
Marius Talagiu's user avatar
0 votes
0 answers

Get video attachment ID and display length

I need to show length of a video attachment. Video is in media library. I put the video normally, by wp administration. I am using this code in content.php, inside the loop, after this: <?php ...
user3720387's user avatar
2 votes
1 answer

Replacing with(out) regex link to attachment by links to files

I tried to do it myself but I have really hard time with Regex (regex is hell. I just don"t understand). Anyway, I think this would be usefull to some people. The context is that we use a plugin to ...
Simon's user avatar
  • 1,208
3 votes
1 answer

Generating Responsive Background Image Sizes in PHP

Im trying to generate responsive background images for my page header, using a modified version of this gist, but I cant get it to work correctly, and Im not sure if the issue is with ...
Dovid Levine's user avatar
0 votes
1 answer

get_post_meta image width for lazy load

I'm trying to lazy load a page of images in Wordpress - I've tried the plugins but none of them seem to work(I only want to lazy load image on some pages.) So I'm now trying to do it with a plugin - ...
Simon Cooper's user avatar
0 votes
1 answer

Is it possible to get feature image url (full-size) from an image url of smaller size?

Supposing that we know nothing except the url of image (smaller size e.g. 150x150) What is the best way to get its full-size image ...
Atthapon Junpun-eak's user avatar
0 votes
1 answer

How to get the cropped image from media library?

i have the url of an image (full size). During the upload it already generates a smaller version (i added this in functions). How can i get this cropped version when i have the full size url? The ...
Nepo Znat's user avatar
  • 189
0 votes
1 answer

Save attachment ID instead of URL in custom field

I am testing several frameworks (currently Vafpress) to help me creating custom meta boxes. I need to save a lot of attachments with my posts but noticed that the attachment is saved with its full URL,...
suntrop's user avatar
  • 133

15 30 50 per page