WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Where to put <script></script>? (5 posts)

  1. Adar1
    Member
    Posted 4 years ago #

    On the one hand I see that many optimization sites give advise to put scripts into footer, but in Worpdress codex it looks like I must put it into header...so where should I put scripts: in header.php or in footer.php?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    That depends upon the script.

  3. Adar1
    Member
    Posted 4 years ago #

    so there is no stupid rule like all put in footer or header?

  4. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    Not that I know of. For example if it's an analytics script, it can go in the footer. A script that's used to process page content would probably be better placed in the header using wp_enqueue_script.

  5. Adar1
    Member
    Posted 4 years ago #

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic