Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
    
Can you explain why you want to edit that code? These scripts are core scripts, enqueued by WordPress itself. –  EAMann Feb 2 '13 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 Feb 2 '13 at 2:10
add comment

2 Answers 2

up vote 1 down vote accepted

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');
share|improve this answer
    
Thank you. This worked (with a minor edit) :) –  m3tsys Feb 2 '13 at 12:33
add comment

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.

share|improve this answer
    
I added that code to functions.php but it doesn't work. –  m3tsys Feb 2 '13 at 11:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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