WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a plugin I want to use, but it depends on the $ identifier, as apposed to using jQuery.

Is it possible to enable the $, to save me recoding the plugin?


The plugin automatically adds the javascript, therefore I can't wrap it.

share|improve this question
Honestly, I'd suggest using a different plugin, then. Or at least forking that plugin and rewriting the javascript to actually work with WordPress. – John P Bloch May 6 '11 at 15:08
Also, if you could add a link to the plugin, we could maybe give you advice on the easiest way to hack the plugin to work correctly. – John P Bloch May 6 '11 at 15:09
Is there not just a way to use $ in wordpress? – Mild Fuzz May 6 '11 at 15:10
de-register jquery and then re-register your own copy without noConflict mode. You risk breaking a lot if you do that, though. – John P Bloch May 6 '11 at 15:52
As long as you kept the version of jQuery you're using identical to the one WordPress uses, you shouldn't have any problems. For example, using jQuery 1.5.x in WP 3.1 breaks almost everything in the admin area. – John P Bloch May 9 '11 at 13:16
up vote 4 down vote accepted

Try this:

jQuery(function ($) {
    /* You can safely use $ in this code block to reference jQuery 
           Call your plugin here

I think you already know this. But still for reference http://api.jquery.com/jQuery.noConflict/

share|improve this answer
Also you can try var $ = jQuery; in the first line of the plugin. Sometime when i need to change all instance of $ to jQuery in a function. i just use it in the first line of the function and it works for me :) Thanks! – Sisir May 6 '11 at 12:05

This should work, I believe:

var $ = jQuery.noConflict();
share|improve this answer
placed anywhere? – Mild Fuzz May 6 '11 at 13:39
Placed above where you want to use $ – Chris_O May 6 '11 at 14:26

The code Sisir provided would work, or you can use this code:

    // you can use $ here
share|improve this answer

Your Answer


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.