• Resolved millennial1

    (@millennial1)


    Hey there,

    I’ve tried troubleshooting the issue first, as well as searching around, but as of yet I haven’t found any info on the topic, so I thought I might ask here to clear all doubts.

    I’m working on an online Staging Site hosted on a subdomain of my site (a SiteGround staging site, should it matter). The staging site is at ‘stagingsite.mysite.com’. I’ve already activated ‘JetPack Safe Mode’ for staging sites. The issue I’m having is with the ‘Top Posts & Pages (JetPack)’ Widget. I have ‘Image List’ active in the widget options. The problem is that the links to the images are also getting updated to the staging site subdomain, and thus the images don’t show (they get substituted by alternative text) which is a big issue for the utility of a staging site when working on visual aspects.

    Since, for the ‘Top Posts’ widget, jetpack hosts the images at 'https://i2.wp.com/mysite.com/...', and when I create the staging site those links get changed to 'https://i2.wp.com/stagingsite.mysite.com/...', the images are of course 404. Since JetPack already knows it is a Staging Site (hence prompting me to activate ‘Safe Mode’) is there any way to get JetPack to not change those image urls to the staging site subdomain? I’m not sure if JetPack is assuming the domain from the ‘WP_HOME’/’WP_SITEURL’ values, but it’s an issue nonetheless. Given that JetPack decides the posts/links that go in that Widget, I’m not sure which would be the proper way to fix those links as they may change.

    As far as fixes, I’ve tried playing around with redirecting them via the Redirection Plugin inside WordPress, as well as through .htaccess, but I haven’t had any success so far. Since it’s the on page image that is not found, as opposed to clicking on an actual link, I’m not even sure those methods would work. Note – I don’t have ‘Enable site accelerator’ active, so it isn’t a JetPack CDN issue.

    Before spending any further time on the subject I thought I might ask if this is a known issue and there’s some recommended fix? I know this isn’t exactly JetPack’s “fault”, but maybe you guys are already familiar with it.

    Thanks ahead for any help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor James Huff

    (@macmanx)

    Are the images in the staging site sourced from the live site’s domain? If so, that’s why the image CDN is pulling them from there.

    Thread Starter millennial1

    (@millennial1)

    Are the images in the staging site sourced from the live site’s domain? If so, that’s why the image CDN is pulling them from there.

    If the functioning image in the ‘Top Posts & Pages (JetPack)’ Widget on the live site is, say:
    https://i0.wp.com/millennialdiyer.com/wp1/wp-content/uploads/2019/01/Kawasaki-Ninja-300-Upgrades-List-Title-Thumbnail.jpg?resize=150%2C150&ssl=1

    In the staging site JetPack assumes the image is at:
    https://i0.wp.com/stagingsite.millennialdiyer.com/wp1/wp-content/uploads/2019/01/Kawasaki-Ninja-300-Upgrades-List-Title-Thumbnail.jpg?resize=150%2C150&ssl=1
    Since JetPack hasn’t cached the images for the staging subdomain, those images are broken links. JetPack is on ‘Safe Mode’, but I suppose it’s still getting the sites URL from wp-config.php (which gets changed to the staging site url). In any case the images don’t display properly, and it doesn’t appear as if the CDN will simply index them later if given time.

    Since what that specific JetPack widget displays is out of one’s control, I’m not exactly sure what approach would work to fix it from the user’s side, if any. I imagine I’m not the only one who has had this type of issue with a staging site, so I was hoping someone might point me in the right direction as far as what to look into to address it.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    If you’d rather not use Jetpack’s Image CDN in that widget on your staging site, I would recommend adding the following code snippet to a functionality plugin on that site:

    add_filter( 'jetpack_photon_development_mode', '__return_true' );

    That should do the trick.

    Thread Starter millennial1

    (@millennial1)

    @jeherve – Thanks! That took care of the issue right away. If anything, regretfully that also removes image optimizations such as the top post’s typical square crop, but that’s something I can perfectly live with for now. I appreciate the help. Have a good one, guys.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Issue with JetPack ‘Top Posts’ widget images on Staging Site’ is closed to new replies.