WordPress.org

Ready to get started?Download WordPress

Ideas

Enqueue JavaScript at the bottom

  1. oncletom
    Member

    12345

    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>
    ...

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

    Posted: 6 years ago #
  2. Jen Mylo
    Key Master

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

    Posted: 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    5 Votes
  • Status

    Sorry, not right now