• Resolved netteli

    (@netteli)


    My snippet involves creating a preload request for the LCP image in the header of each page in HTML.

    Ideal HTML:

    <link href="https://cdn.example.sg/image-title.jpg" rel="preload" as="image" type="image/jpeg" fetchpriority="high">

    After saving changes, the HTML gets overwritten to:

    <link href="https://example.com.sg/wp-content/uploads/image-title.jpg" rel="preload" as="image" type="image/jpeg" fetchpriority="high">

    Do note the difference in the URL, and the addition of the wp-content path in the URL.

    My images have been moved to CDN in a separate domain (cdn.example.sg). My current domain is example.com.sg

    How do I stop the plugin from overwriting the entire URL? As long as .com has been removed, the entire URL gets overwritten.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mircea Sandu

    (@gripgrip)

    Hi @netteli,

    That seems to be caused by the CDN plugin you are using as it seems to be attempting to replace the links across the site when saving the snippet.

    WPCode does no such replacements and we’re happy to guide you to how to overcome this if you can share more details about what you are using to add the CDN to your website.

    Thread Starter netteli

    (@netteli)

    Thanks for clarifying! I did not get this issue with other plugins but I hope its CDN that’s causing it. I am using DigitalOcean and Amazon Cloudfront as CDN.

    Plugin Author Mircea Sandu

    (@gripgrip)

    Hi @netteli,

    Are you using any plugin on the WordPress side to handle the CDN?

    Thread Starter netteli

    (@netteli)

    Yes I’ve enabled Amazon Cloudfront CDN via W3 Total Cache plugin, and Digital Ocean CDN via WP Offload Media plugin.

    Plugin Author Mircea Sandu

    (@gripgrip)

    Is the URL still being replaced when those plugins are deactivated?

    Do you have a staging site available to test this?

    Thread Starter netteli

    (@netteli)

    I’ve tried deactivating WP Offload Media and it seems to be the cause of the URL replacement. Thanks for your help

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

The topic ‘URL keeps getting overwritten’ is closed to new replies.