WordPress.org

Ready to get started?Download WordPress

Forums

WP jQuery CDN
init hook is not recommended and can you add a feature to setup user library (3 posts)

  1. librazh
    Member
    Posted 2 years ago #

    1. The 'init' hook is not recommended while registering the script libraries. So I updated the plugin by myself, and it works. Please refer to http://codex.wordpress.org/Function_Reference/wp_enqueue_script which mentioned that "by using the wp_enqueue_scripts hook (instead of the init hook which many articles reference), we avoid registering the alternate jQuery on admin pages, which will cause post editing (amongst other things) to break after upgrades often."

    2. There is no way in the plugin to add my own jQuery library served on another CDN, so I have to modify the plugin by myself. It may cause setting losing if the plugin is being upgraded. Can you add a feature to let the user input the library URL by themselves?

    http://wordpress.org/extend/plugins/wp-jquery-cdn/

  2. librazh
    Member
    Posted 2 years ago #

    One more problem, the plugin is generating below URL for script, is it correct?

    <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery//jquery.min.js?ver=3.3.1'></script>

  3. InertiaInMotion
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Librazh,

    Thanks for the suggestions, And sorry about the HUGE! delay in this response, We have become quite busy this year and have had very little time to tinker with other little side projects such as this plugin.

    Also in regards to the problem you are experiencing.
    I gather you have selected the Google CDN option,
    Are you able to provide me with some more information?

    Such as.
    What version of the plugin are you running?
    What is entered in the jQuery Version input field?
    Have you modified the plugin in any way?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic