Placing a gif in head


What is the best method to place a gif with a non looping animation into a header template?

The issue is once the animation is played one, the gif is cached in browser and animation won’t replay when internal links are clicked or the page is refreshed.

We used javascript to add a query string to the end of the gif src and that resolved the issue, however it seems adding javascript has broken the preview for the header template editor.

Many Thanks

Hi @theotcspace,

Thanks for reaching out.

There might be multiple reasons behind this gif issue. One of them is the size of the image, just remember that When you upload your GIF in WordPress, go to the image settings of the GIF, and under the image size option, select Full Size.
Even after setting the image size to Full Size will not fix the issue and your GIF will not animate.
This is mostly because of image optimization plugins that resize the image. Many popular image optimization plugins resize the images even after you explicitly set a size for the image.

I would also suggest you troubleshoot the following issues from our common issue article:

  1. Disabling Cache

  2. Disabling CDN

Hope it helps.


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.