I would like to ask how to get the specific title attribute of wordpress image from wordpress media?
Those information that are being inputted upon uploading the images life, title, alt captions, description.
I would like to ask how to get the specific title attribute of wordpress image from wordpress media?
Those information that are being inputted upon uploading the images life, title, alt captions, description.
You can find specific attribute of wordpress image attachment.
<?php
$attachment_id = 8; // attachment ID
$image_attributes = wp_get_attachment_image_src( $attachment_id ); // returns an array
if( $image_attributes ) {
?>
<img src="<?php echo $image_attributes[0]; ?>" width="<?php echo $image_attributes[1]; ?>" height="<?php echo $image_attributes[2]; ?>">
<?php } ?>
An array containing:
[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.