Get_attached_media not working

I am trying to use get_attached_media function to get all images uploaded to a post, but is giving me “wp-content/uploads” version of URL not Sage 9 “app/uploads” based.

Help me please.

Can you post your existing code, and tell us what you’ve tried so far?


in TeemplateLanding.php:

public function slider() {
if( get_field('hasSlider') ) {
  return get_attached_media( 'image/jpeg', get_post()->ID );


In my landing.blade.php view:

I am getting:

array(7) { [28891]=> object(WP_Post)#9665 (24) { ["ID"]=> int(28891) ["post_author"]=> string(3) "850" ["post_date"]=> string(19) "2018-02-20 15:52:41" ["post_date_gmt"]=> string(19) "2018-02-20 20:52:41" ["post_content"]=> string(0) "" ["post_title"]=> string(21) "_8ML1905_Alta_Baja-02" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "inherit" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(6) "closed" ["post_password"]=> string(0) "" ["post_name"]=> string(21) "_8ml1905_alta_baja-02" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-02-20 15:58:06" ["post_modified_gmt"]=> string(19) "2018-02-20 20:58:06" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(28825) ["guid"]=> string(76) "//localhost:3000/wp-content/uploads/2018/02/8ML1905_Alta_Baja-02.jpg" ["menu_order"]=> int(2) ["post_type"]=> string(10) "attachment" ["post_mime_type"]=> string(10) "image/jpeg" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [28835]=> object(WP_Post)#9666 (24)...

I realize that images were uploaded in a WordPress with Sage 8 based theme. Now, i tryed uploading a new image and it is working.

Thank you for you time, sir. I gonna mark as resolved.

The only URL I see here is the GUID, which doesn’t really matter: It’s just intended to be a unique identifier, not the actual location of a file.

Glad you seem to have figured it out, though. :slight_smile: