Support » Fixing WordPress » Image Alt Text possible with this?

  • Using a custom field to generate image. Need to pull the alt text as well. Here is what I’m using.

    <?php  if((get_post_meta($post->ID, "image", true))) { ?>
    <img src='/images/<?php echo get_post_meta($post->ID, "image", true); ?>' />
     <?php } ?>
Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael


    Forum Moderator

    add another custom field for the ‘alt’ text?

    I will try that. Thanks!

    I tried this, but it leaves me with a blank “alt”. I read this is where word press stores _wp_attachment_image_alt is where it’s alt text for images.

    <img alt='<?php get_post_meta($post->ID, '_wp_attachment_image_alt', true); ?>



    Forum Moderator

    you are not using an attachment image, you are using a image name in you first custom field – how is the code to know the connection?

    i meant you need to crate a new custom field and type the alt text into it, the same way you enter the image name into the first custom field.

    I completely overlooked the connection part. haha maybe its time for a break. I understood you, I was trying to prevent an extra custom field. Thanks! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Image Alt Text possible with this?’ is closed to new replies.