Get Attachment Custom Field value

I have a custom field in my Attachment form for WordPress.

I am storing values in this & would now like to display the value at the public end.

Read More

Going by this http://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata, this should help, but doesn’t:
<?php wp_get_attachment_metadata( $attachment_id, $unfiltered ); ?>

Can someone please assist?

Thank you

Related posts

Leave a Reply

1 comment

  1. wp_get_attachment_metadata result is:

    Array
    (
        [width] =>
        [height] =>
        [file] =>
        [sizes] => Array
            (
                [thumbnail] => Array
                    (
                        [file] =>
                        [width] =>
                        [height] =>
                        [mime-type] =>
                    )
    
                [medium] => Array
                    (
                        [file] =>
                        [width] =>
                        [height] => 
                        [mime-type] => 
                    )
    
            )
    
        [image_meta] => Array
            (
                [aperture] => 
                [credit] => 
                [camera] => 
                [caption] => 
                [created_timestamp] => 
                [copyright] => 
                [focal_length] => 
                [iso] => 
                [shutter_speed] => 
                [title] => 
            )
    
    )
    

    So, this is attachment datails. But you want get custom fields. You can use same as post:

    get_post_meta($post->ID, 'your_field_name', true);
    

    all of which avaible in attachment.php. In attachment page, $post is attachment post, so not parent post.