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.

I have gotten rid of the wlwmanifest_link and jquery, since I load it from a compressed version and at the footer, but I can't find a way to get rid of the swfobject.js.

This is the code I used to get rid of the other two in my functions.php file: remove_action('wp_head', 'wlwmanifest_link'); if ( !is_admin() ) wp_deregister_script('jquery');

Replacing either with 'swfobject' does not remove it, so there must be another way.

share|improve this question

2 Answers 2

if you have unwanted javascript on your page, it usually comes from plugins. deactivate them, and see if the javascript is still there. if it still is, try updating wordpress, or switching to another theme. if not, activate the plugins one by one, and check which one is putting this script to your head. after finding the plugin, decide if you need it, and if you do, search the source of the plugin to find out the handle for the javascript ressource. afterwards you can deregister the script in your functions.php.

okay, so my last option would be this:

wp_dequeue_script( 'swfobject' );

previously, you just deregistered the script, i don't know if it stays enqueued in this case.

share|improve this answer
    
I created my own theme and only use necessary javascripts. It is probably coming from the Media Elements player, however, I have that loaded on demand, so it only displays when I call the plugin on a post or page. IIRC, Swfobject.js is a universal WP script for all themes, by the way. –  AAA May 4 '12 at 15:09
1  
okay, i get that the mediaplayer just loads when you call them in the content, but usually a plugin always inserts the scripts to the head, even when not needed. –  fischi May 4 '12 at 15:10
    
I mean that it doesn't load the .js file into the header -- only the .css file for it. The swfobject is a part of /wp-includes/ and not the Media Elements player, though. –  AAA May 4 '12 at 15:44

From the update blog in Codex:

SWFObject, which WordPress previously used to embed Flash content, and may still be in use by plugins and themes.

So, this is used by some of your plugins. As previously stated by @fischi you should deactivate all your plugins, reload and then find out which exact plugin is adding the script.

Then just make a cross file search through the plugin folder (with for e.g. Notepad++) for the file name.

Then find out on which hook and on which priority the script was added. Then use remove_action - or wp_dequeue_script() in a later hook - to remove it.

share|improve this answer

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.