<?php
$image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
echo $image;
?>
Hope it helps.
Thanks.
Vicky
Thank you very much for replying.
Unfortunately if I try functions like wp_get_attachment_url (even without the echo command), I get a blank page instead of the edit one…
BTW, “echo $post->ID” does not print anything….
Make it global $post;
<?php
global $post;
$image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
echo $image;
?>
No way 🙁
the line “$image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );” causes a blank page (all the admin area goes off…)
At (about) line 4148 there’s this function:
function wp_get_attachment_metadata( $post_id = 0, $unfiltered = false ) {
$post_id = (int) $post_id;
if ( !$post = get_post( $post_id ) )
return false;
$data = get_post_meta( $post->ID, '_wp_attachment_metadata', true );
if ( $unfiltered )
return $data;
return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID );
}
I’ve tried to declare $data as global but it is still void outside the function…
why arent you writing a plugin that does that once save_post is called?
http://codex.wordpress.org/Plugin_API/Action_Reference/save_post