WordPress.org

Support

Support » Plugins and Hacks » Get media info based on media id

Get media info based on media id

  • I want to do a query to get the info of a graphic in the media library and get the title and description. I know the ID of the graphic but not sure how I would do this.

    Does it require me to do a mysql query?

    Chris

Viewing 1 replies (of 1 total)
  • I figured it out. By the way I am using the attachment plugin but wanted the title and description of the image so that I didn’t have to re-enter it every time.

    $querystr = “SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = “.$attachments[$i][‘id’];
    $pageposts = $wpdb->get_results($querystr, OBJECT);
    echo $pageposts[0]->post_title;
    echo $pageposts[0]->post_content;

Viewing 1 replies (of 1 total)
  • The topic ‘Get media info based on media id’ is closed to new replies.
Skip to toolbar