Forum Replies Created

Viewing 1 replies (of 1 total)
  • You can try to query the image directly from the database:

    global $wpdb;
    $query = "SELECT ID FROM {$wpdb->prefix}posts WHERE post_name LIKE '{$img_name}' AND post_type LIKE 'attachment'";
    $thumb_id = $wpdb->get_var($query);
    if( !is_null($thumb_id) ) {
        $attachment = wp_get_attachment_image_src($thumb_id, 'full');
        $img_url = $attachment[0];
    }

    The question was posted more than 1 month ago, so I don’t think it will be useful for author. But I hope it will be helpful for someone else.

Viewing 1 replies (of 1 total)