Title: WordPress adding absolute paths
Last modified: August 30, 2016

---

# WordPress adding absolute paths

 *  Resolved [GeertvanH](https://wordpress.org/support/users/geertvanhorrik/)
 * (@geertvanhorrik)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/wordpress-adding-absolute-paths/)
 * Hi,
 * I am trying to use this with wordpress 4.4 and Azure hosting. The plugin generates
   the following code (notice the d:homesitewwwroot it is adding):
 *     ```
       <img width="36" height="36" src="http://static.mywebsite.com/website/myaction_express_menu_icon-36x36.png" class="attachment-menu-36x36 size-menu-36x36" alt="myaction_express_menu_icon" srcset="http://www.mywebsite.com/wp-content/uploads/D:homesitewwwroot/wp-content/uploads/myaction_express_menu_icon-50x50.png 50w, http://www.mywebsite.com/wp-content/uploads/D:homesitewwwroot/wp-content/uploads/myaction_express_menu_icon-75x75.png 75w, http://www.mywebsite.com/wp-content/uploads/D:homesitewwwroot/wp-content/uploads/myaction_express_menu_icon-24x24.png 24w, http://www.mywebsite.com/wp-content/uploads/D:homesitewwwroot/wp-content/uploads/myaction_express_menu_icon-36x36.png 36w, http://www.mywebsite.com/wp-content/uploads/D:homesitewwwroot/wp-content/uploads/myaction_express_menu_icon-48x48.png 48w, http://www.mywebsite.com/wp-content/uploads/D:homesitewwwroot/wp-content/uploads/myaction_express_menu_icon.png 80w" sizes="(max-width: 36px) 100vw, 36px">
       ```
   
 * As you can see, it adds the right src url, but the whole srcset is wrong. I did
   try to understand whats going on by doing the following:
 * 1. Search if the plugin is responsible for the srcset (I think it’s not)
    2. 
   Check the usage of wp_get_attachment_image_src() (might be, but what is causing
   this?) 3. Tried customizing the path in the wp-config.php (using define(‘UPLOADS’,‘
   wp-content/uploads’);)
 * Nothing seems to work. Happy to do a PR, but it would be great if you could give
   me some points that might help finding this issue.
 * [https://wordpress.org/plugins/menu-image/](https://wordpress.org/plugins/menu-image/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [zviryatko](https://wordpress.org/support/users/zviryatko/)
 * (@zviryatko)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/wordpress-adding-absolute-paths/#post-6869118)
 * Hi, it’s a core issue, look at this function [https://core.trac.wordpress.org/browser/tags/4.4/src/wp-includes/media.php#L1067](https://core.trac.wordpress.org/browser/tags/4.4/src/wp-includes/media.php#L1067),
   I think you can fix it by using this filter `wp_calculate_image_srcset`.
 *  Thread Starter [GeertvanH](https://wordpress.org/support/users/geertvanhorrik/)
 * (@geertvanhorrik)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/wordpress-adding-absolute-paths/#post-6869191)
 * Thanks for the fast reply, it was really helpful!
 * I made 2 changes that “fixes” the issue:
 * 1. Add this code to __construct in menu-image.php
 *     ```
       // Fix for broken images on azure & wordpress 4.4
       add_filter( 'wp_calculate_image_srcset', 'fix_broken_image_sources', 10, 2 );
       ```
   
 * 2. Add this method below the __construct method:
 *     ```
       /**
        * Fixes broken image sources as discussed in https://wordpress.org/support/topic/wordpress-adding-absolute-paths
        */
       public function fix_broken_image_sources($sources, $size_array, $image_src, $image_meta, $attachment_id) {
       	return false;
       }
       ```
   
 * I am not very good with php (been a *long* time ago), but this seems to fix it
   for now.
 *  [zviryatko](https://wordpress.org/support/users/zviryatko/)
 * (@zviryatko)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/wordpress-adding-absolute-paths/#post-6869389)
 * Sorry, but it’s not a fixing problem, this code just disable srcset property 
   for images, so i can’t add this to plugin, better add this to your theme functions.
   php, btw, it’s a core bug, i think maybe there is exists a patch, if not just
   write your problem to wordpress core bug tracker.
 *  Thread Starter [GeertvanH](https://wordpress.org/support/users/geertvanhorrik/)
 * (@geertvanhorrik)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/wordpress-adding-absolute-paths/#post-6869390)
 * Fully understand. It was more as information for other users having the same 
   issue. I hope they fix this in WordPress (then it’s no longer required).
 *  [zviryatko](https://wordpress.org/support/users/zviryatko/)
 * (@zviryatko)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/wordpress-adding-absolute-paths/#post-6869391)
 * Ok, I add this to FAQ section.
 *  [977KG](https://wordpress.org/support/users/gkhatri/)
 * (@gkhatri)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/wordpress-adding-absolute-paths/#post-6869508)
 * Hi there,
    I am using plugins on one of my sites that I built. I was able to 
   use this plugins and replaced normal text with image. Now the problem is I want
   to use different image/replace image with new version.
 * No matter what, the size keeps on dropping to 36×36. any suggestion?
    How can
   i force the image to use original size ie. 250x180px
 * Regards
    g.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘WordPress adding absolute paths’ is closed to new replies.

 * ![](https://ps.w.org/menu-image/assets/icon-128x128.png?rev=2123398)
 * [Menu Image, Icons made easy](https://wordpress.org/plugins/menu-image/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/menu-image/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/menu-image/)
 * [Active Topics](https://wordpress.org/support/plugin/menu-image/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/menu-image/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/menu-image/reviews/)

 * 6 replies
 * 3 participants
 * Last reply from: [977KG](https://wordpress.org/support/users/gkhatri/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/wordpress-adding-absolute-paths/#post-6869508)
 * Status: resolved