How to get the medium size post thumbnail url in wordpress?
Use wp_get_attachment_image_src(get_post_thumbnail_id($post_array->ID), 'medium')
.
This will return you an array with URL, width, height and cropping mode of this image.
EDIT: Updating to add the full code:
$categories = get_category_by_slug('my_category_slug');$posts_array = get_posts( array('category' => $categories->term_id, 'numberposts' => -1 ));foreach($posts_array as $post_array){ if( has_post_thumbnail($post_array->ID) ) { $image_arr = wp_get_attachment_image_src(get_post_thumbnail_id($post_array->ID), 'medium'); $image_url = $image_arr[0]; // $image_url is your URL. }}