I'm trying to write a piece of code that fetches the url/download link of any embedded audio files in the current post. In doing this I stumbled upon get_attached_media which outputted something like this (I have removed some of the values in order to keep it short):
Array (
[172] => WP_Post Object (
[ID] => 172
[post_author] => 1
[guid] => http://localhost/wp-content/uploads/2013/07/03-take_me_out_128_lame_cbr_ex.mp3
[menu_order] => 0
[post_type] => attachment
[post_mime_type] => audio/mpeg
)
)
As you can tell it is all wrapped in this "WP_Post Object". Now, I'm sure this is all common place and fairly simple to resolve, but I can't figure out how. Essentially, what I want to do is to fetch the "GUID" value and attach it to a variable, as it seems to contain the URL of the post's embedded audio file.
Also, please correct my terminology so I can make this question more useful to others who migh seek an answer to this.
$array[172]->guid
- this is standard PHP. A more lengthy explanation (next to the PHP manual) is here: Able to see a variable in print_r()'s output, but not sure how to access it in code