Ikool’s Blogbed

Fix of issues with old version of jQuery in WordPress 2.5.1 when using FeedWordPress

Recently I installed wordpress 2.5.1 and FeedWordpress plugin, wanted to load some of my favorite news RSS, and everything works fine except some of the administrator features with drag and drop capabilities are failed. especially when I was trying to re-arrange sidebar widgets. Here is the error message:

Error: jQuery(“#tags-input”).val() has no properties

After spending sometime debugging it, and I found that FeedWordpress (the version that I am using is 0.993) doesn’t do a good validation before making the call to val() for the jQuery object since the DOM node corresponding to “#tags-input” might not exist. And the code is located in /wp-admin/js/post.js. There are two places needed to be fixed in the file, one is in function tag_update_quickclicks(), and another in function tag_flush_to_text(). Here is the fix for tag_update_quickclicks:

function tag_update_quickclicks() {
var tags = jQuery( ‘#tags-input’ );
if (tags.length>0) {
var current_tags = tags.val().split(‘,’);
jQuery( ‘#tagchecklist’ ).empty();
shown = false;
// jQuery.merge( current_tags, current_tags ); // this doesn’t work anymore, need something to array_unique
jQuery.each( current_tags, function( key, val ) {
val = val.replace( /^\s+/, ” ).replace( /\s+$/, ” ); // trim
if ( !val.match(/^\s+$/) && ” != val ) {
txt = ‘X ‘ + val + ‘ ‘;
jQuery( ‘#tagchecklist’ ).append( txt );
jQuery( ‘#tag-check-‘ + key ).click( new_tag_remove_tag );
shown = true;

if ( shown )
jQuery( ‘#tagchecklist’ ).prepend( ‘‘+postL10n.tagsUsed+’‘ );

Here is the fix for tag_flush_to_text:

function tag_flush_to_text() {
var tags = jQuery(‘#tags-input’)

if (tags.length > 0) {
var newtags = jQuery(‘#tags-input’).val() + ‘,’ + jQuery(‘#newtag’).val();
// massage
newtags = newtags.replace( /\s+,+\s*/g, ‘,’ ).replace( /,+/g, ‘,’ ).replace( /,+\s+,+/g, ‘,’).replace( /,+\s*$/g, ” ).replace( /^\s*,+/g, ” );
jQuery(‘#tags-input’).val( newtags );
return false;

I hope this will be fixed once the next version WordPress is released.


June 10, 2008 - Posted by | Wordpress Plugins | , , , ,


  1. […] fix for this is not so easy, I thought I could apply the same principal like what I did in the previous article to fix it, however it didn’t work. Now I am stuck here and going to spend more time to find […]

    Pingback by Compatibility issue of Thickbox and jQuery in Wordpress when both NextGen Gallery and WP e-commerce present « Ikool’s Blogbed | June 14, 2008 | Reply

  2. It works now, thanks for the fixes!


    Comment by Michael | September 4, 2008 | Reply

  3. There’s an error in this script, causing a JS error in the backend.

    […] shown = false; […] should be outside the IF statement (ie. 4 lines higher), as “shown” now is undefined when tagslenght isn’t bigger than zero.

    Move “shown = false;” to the top of this function and it works flawlessly.

    Comment by Ronald Kools | September 23, 2008 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: