WordPress.org

Support

Support » How-To and Troubleshooting » Remove unwanted scripts from the header

Remove unwanted scripts from the header

  • I have all sorts of plugins I will never need and unlike previous versions, they are not included in the header.php file anymore.

    From what particular file are they actually loaded?

    I know I can do stuff like remove_action( ‘wp_head’, ‘rsd_link’ ); in my functions.php file but I still want to know the file that loads them and eventually comment them out manually.

    Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • If they’re being added by plugins you no longer use, you could just deactivate and delete the plugin. If you want to provide a link to your site, I (or someone) could take a look at what scripts are being added. The specific script you mention is added by WordPress itself; unless you want to alter core files (not a good idea) the way to remove it would be like you said:

    remove_action( 'wp_head', 'rsd_link' );

    Thank you for your reply but I would like to have total control on whatever is loading and even if I will not delete the lines like I used to do from the header, is still a challenge to find out how they are loaded?

    Without a link to see exactly which lines you want to get rid of, it’s impossible to say where they’re being added (plugin, theme, or core).

    script-loader.php in wp-includes. That is the answer.

    I can’t believe no one is concerned about this as I am pretty sure loads of people would like to get rid of stuff like xmlrpc.php?rsd or l10n.js?ver=20101110.

    It was a lot easier before, just to remove what you don’t need from header and we had total control over it.

    script-loader.php in wp-includes. That is the answer.

    I can’t believe no one is concerned about this as I am pretty sure loads of people would like to get rid of stuff like xmlrpc.php?rsd or l10n.js?ver=20101110.

    It was a lot easier before, just to remove what you don’t need from header and we had total control over it.

    edited*

    Editing core files isn’t a good idea. The proper way to remove the links to xmlrpc.php and wlwmanifest.xml is by adding something like this to your theme’s functions.php or a custom plugin:

    remove_action( 'wp_head', 'rsd_link' );
    remove_action( 'wp_head', 'wlwmanifest_link' );

    To remove l10n.js (or any registered script) you can simply deregister it like this:

    if ( !is_admin() ) {
        add_action( 'init', 'my_init' ); 
    
        function my_init() {
            wp_deregister_script( 'l10n' );
        }
    }

    Function Reference/wp deregister script

    I would image most people aren’t too concerned about this. The files added by WordPress itself are fairly small and necessary for certain functionality.

    As far as I know that is an interface (xmlrpc) for some API’s. Now, I don’t really need that but in WordPress 3.2.1 the following won’t remove that:

    remove_action( ‘wp_head’, ‘rsd_link’ );

    Neither commenting the line out from default-filters. Erm, any ideas?!

    Big Bagel
    Member

    @big-bagel

    remove_action( 'wp_head', 'rsd_link' ); works just fine. Make sure you’re adding it in the proper place and that you aren’t seeing a cached version of your site.

    Just to add a couple references for any future visitors:

    XML-RPC Support
    Weblog Client

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Remove unwanted scripts from the header’ is closed to new replies.