0

<?php wp_head(); ?> from my default wp theme generates

<script type='text/javascript' src='http://example.com/wp-includes/js/comment-reply.min.js?ver=3.5.1'></script>
<script type='text/javascript' src='http://example.com/wp-includes/js/jquery/jquery.js?ver=1.8.3'></script>

The question is... What is generating those two lines and how can i edit that code?

2
  • Can you explain why you want to edit that code? These scripts are core scripts, enqueued by WordPress itself.
    – EAMann
    Commented Feb 2, 2013 at 2:01
  • Hi @EAMann! I simply want to change the filepath; removing wp-includes , ?ver=3.5.1 / ?ver=1.8.3 and add google's hosted jquery with local fallback. The problem is that i didn't found anything that make reference to that piece of code.
    – m3tsys
    Commented Feb 2, 2013 at 2:10

2 Answers 2

1

To disable comment-reply go to Discussion Settings and disable Threaded (nested) comments.

Google-hosted jQuery:

function my_scripts() {
    wp_dequeue_script('jquery');

    wp_enqueue_script(
        'jquery', // name
        '//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js', // google hosted, protocol-independent
        array(), // dependencies (empty)
        NULL, // removes version
        true // load in footer, 'false' for header
    );

}    
add_action('wp_enqueue_scripts', 'my_scripts');
0
1

Those lines are inserted by functions hooked to wp_enqueue_scripts as in this example from the Codex:

function my_scripts_method() {
    wp_enqueue_script('scriptaculous');            
}    
add_action('wp_enqueue_scripts', 'my_scripts_method');

The scripts themselves were registered and/or enqueued with wp_register_script or wp_enqueue_script.

You can deregister or dequeue script with wp_deregister_script or wp_dequeueu_script

In your case:

wp_dequeue_script('jquery');
wp-dequeue_script('comment-reply');

But this is a good way to break things. I would not deregister or dequeue core scripts unless I were personally managing a site and would continue to do so for the foreseeable future.

Use Google Libraries should load scripts form Google's servers in little bit safer way that just loading your own local copies.

1
  • I added that code to functions.php but it doesn't work.
    – m3tsys
    Commented Feb 2, 2013 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.