How to get the specific title attribute of WordPress image from WordPress media?

  • Custom WP

Those information that are being inputted upon uploading the images life, title, alt captions, description.

You can find specific attribute of WordPress image attachment.

    $attachment_id = 8; // attachment ID
    $image_attributes = wp_get_attachment_image_src( $attachment_id );

    //Var damp result


    //This  $image_attributes array contain: 

    [0] => url
    [1] => width
    [2] => height
    [3] => boolean: true if $url is a resized image, false if it is the original or if no image is available. 

Custom Function WordPress