How load jQuery with always on top of the page in WordPress

I’m using wordpress mediaupload function in my plugin.

Error: jQuery is not defined
Source File: http://localhost/my_wp/wp-admin/load-scripts.php?c=0&load=utils,thickbox,media-upload&ver=4ec4a484079ac4122099967c5457437d
Line: 19

This is my error message when my plugin load. When i see the code the media upload script is loading first then jquery is loading.
this is my code

Read More
add_action( 'admin_enqueue_scripts', 'wpvote_include_files' );
function wpvote_include_files() {
    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' );
    wp_enqueue_script( 'jquery' );

 wp_enqueue_script('media-upload');
    wp_enqueue_script('thickbox');
    wp_register_script('my-upload', WPVOTE_PLUGIN_URL.'wpmediaupload_scripts.js', array('jquery','media-upload','thickbox'));
    wp_enqueue_script('my-upload');

}

this is my page source code

<script type='text/javascript' src='http://localhost/my_wp/wp-admin/load-scripts.php?c=0&amp;load=utils,thickbox,media-upload&amp;ver=4ec4a484079ac4122099967c5457437d'></script>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js?ver=3.3.2'></script>

Related posts

Leave a Reply

1 comment