Enqueue JavaScript at the bottom

  1. oncletom


    It is a best practice to enqueue external scripts at the bottom of the page to avoid the display delaying of the page.

    Why not having a wp_enqueue_external_script() which would add this systematically in the wp_footer action ?

    It could behave like this :

    function wp_enqueue_external_script($script)
    //if script starts with http/https
    //do a <script ... src="$script"></script>

    //consider this is pure JavaScript
    //do a <script ...>$script</script>

    Posted: 7 years ago #
  2. Jen
    Community Organizer

    No community feedback in the year this post has been there, so am closing thread.

    Posted: 5 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    5 Votes
  • Status

    Sorry, not right now