• Resolved Imageskiluk

    (@skiluk)


    I want to load html code at the top of the page <head>. I put highest priority, but it is still behind other css, and other html add from other plugins. Is there a way to input my html higher up the page?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author ImageSilkyPress

    (@diana_burduja)

    The priority is only relative to other custom codes and not relative to CSS or JS from the theme or other plugins.

    Any WordPress theme allows inserting HTML/CSS/JS in the header only in one place, where the wp_head() function is called.

    In that place any HTML/CSS/JS code is added in the following order:

    1. Theme’s and plugins’ external stylesheets (intermixed)
    2. Simple Custom CSS and JS internal and external stylesheets (intermixed). A custom code’s Priority setting will have effect only within this section.
    3. CSS codes added with the theme’s Customizer

    Thread Starter Imageskiluk

    (@skiluk)

    Thank you for your reply and help. This explains what I am seeing. Maybe there is another way to do what I am trying to do.

    I use Autoptimize to speed up my site. It has the ability to preload assets by placing a HTML link preload tag at the top of the page for the assets, however it is site-wide. I was hoping to use this plugin to do the same thing, but on a post/page basis as the assets are different. However, since the HTML code is placed farther down the page, the asset is pre-loaded too late so I am not getting much speed benefit.

    Do you have any ideas on how to prioritize the custom HTML code?

    Plugin Author ImageSilkyPress

    (@diana_burduja)

    As far as I know the preloading functionality has to do with the “preload” attribute in the <link> or the <script> tag and is independent of the tag’s place in the HTML header. At least these two articles (MDN Web Docs and Web Speed Tools) don’t mention anything about the tag’s place in the HTML header.

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

The topic ‘HTML priority’ is closed to new replies.