{"id":4382127,"date":"2013-12-05T09:28:50","date_gmt":"2013-12-05T09:28:50","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/wp_upload_dir-urls-wrong\/"},"modified":"2016-08-21T13:13:21","modified_gmt":"2016-08-21T13:13:21","slug":"wp_upload_dir-urls-wrong","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/wp_upload_dir-urls-wrong\/","title":{"rendered":"wp_upload_dir() urls wrong"},"content":{"rendered":"<p>Hi all,<\/p>\n<p>Out-of-the-box this plugin doesn&#8217;t map media urls to the mapped domain.<br \/>\nFor example, if my network is subdomain.domain.com and a site on the network is site2.domain.com, the media URLs will still be site2.subdomain.domain.com.<\/p>\n<p>I&#8217;m using the following fix:<br \/>\nadd_filter( &#8216;wp_get_attachment_url&#8217;, &#8216;domain_mapping_post_content&#8217; );<\/p>\n<p>Found here:<br \/>\nhttps:\/\/wordpress.org\/support\/topic\/small-patch-for-next-update-media-file-urls?replies=8<\/p>\n<p>In my theme, there are a few places where the media URLs are gathered using wp_upload_dir().  However, they are site2.subdomain.domain.com, which causes problems.<\/p>\n<p>Is there a way I can apply the fix to the URLs (url and baseurl) returned by wp_upload_dir()?<\/p>\n<p>https:\/\/wordpress.org\/plugins\/wordpress-mu-domain-mapping\/<\/p>\n","protected":false},"template":"","class_list":["post-4382127","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4382127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4382127\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4382127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}