admin管理员组

文章数量:1200344

I'm seeing a weird issue where my site's favicon is not loaded until I accept cookies on a cookie plugin. I wrote the plugin and as far as I know there is no tie of a favicon to cookies and the plugin doesn't explicitly block anything by default. I don't think the favicons are tied to a cookie anyways. Anyone seen this type of behavior before and know how to allow the favicon to load.

Plugin Github

I'm seeing a weird issue where my site's favicon is not loaded until I accept cookies on a cookie plugin. I wrote the plugin and as far as I know there is no tie of a favicon to cookies and the plugin doesn't explicitly block anything by default. I don't think the favicons are tied to a cookie anyways. Anyone seen this type of behavior before and know how to allow the favicon to load.

Plugin Github

Share Improve this question asked Feb 8, 2022 at 21:48 Hunter NelsonHunter Nelson 1487 bronze badges 4
  • How was the favicon added? Using WordPress? Or by adding a favicon.ico file? Something else? – Jacob Peattie Commented Feb 8, 2022 at 23:27
  • have you checked your browsers dev tools for errors? How are you loading the favicon? – Tom J Nowell Commented Feb 9, 2022 at 0:10
  • No errors or messages. The favicon loads fine after I accept or deny cookies and refresh the page, just not before. – Hunter Nelson Commented Feb 11, 2022 at 7:53
  • I am using native WordPress favicon loads. I uploaded the favicon through the customizer and I've also put a link to the file in the HTML for the page. – Hunter Nelson Commented Mar 14, 2022 at 1:52
Add a comment  | 

1 Answer 1

Reset to default 0

I figured out the issue. In my plugin I was calling an echo statement from a WP_Head function. This was causing the <head> tag to be immediately closed and rendered in the body. Any remaining code for the WP_Head was being output in the body, including the favicon <link> tags.

本文标签: Favicon not loading until cookies are accepted