WordPress.org

Ready to get started?Download WordPress

Forums

Remove unwanted scripts from the header (10 posts)

  1. Chris Demetriad
    Member
    Posted 2 years ago #

    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.

  2. Big Bagel
    Member
    Posted 2 years ago #

    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' );

  3. Chris Demetriad
    Member
    Posted 2 years ago #

    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?

  4. Big Bagel
    Member
    Posted 2 years ago #

    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).

  5. Chris Demetriad
    Member
    Posted 2 years ago #

    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.

  6. Chris Demetriad
    Member
    Posted 2 years ago #

    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.

  7. Chris Demetriad
    Member
    Posted 2 years ago #

    edited*

  8. Big Bagel
    Member
    Posted 2 years ago #

    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.

  9. Chris Demetriad
    Member
    Posted 2 years ago #

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

  10. Big Bagel
    Member
    Posted 2 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic