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-logo' );
The reason for this is because I want the logo to be compatible with the WP Retina 2x plugin. That’s why I’m using the thumbnail-sizing above. This way, the user only has to upload one big image and everything else will be taken care of by the code.
I’ve already tried all the different attachment_src_to_id
functions out there but none of them works and only returns null
or false
. This for instance
Even when I type the URL manually as a parameter, it still returns negative.
However when I type the ID manually inside wp_get_attachment_image
, it shows as expected.
Have something changed in WP v3.9 that causes these functions to return false?
Perhaps there is some way to extend the Customizer’s image control to receive the attachment ID?
Any ideas? 🙂