Querystring data gets truncated

As you have asked wether or not you have done the url encoding for the ampersands right, then my answer is: No.

You are calling a javascript function, you’re not outputting something as x(ht)ml. You therefore do not need to encode & as &. The function is expecting a URL not a string that contains an xml encoded url.

But that’s probably nit-picking.

The reason why this does not work is, that tb_show() cut’s away anything after the first TB_ it finds in that URL, and only the part of the URL before that string is preserved for the iframe src. So you need to move the TB_iframe=true to the end of the parameter. This should do the trick:

tb_show('', 'media-upload.php?post_id='+post_id+'&type=image&wpe_idCustomAttachment=true&TB_iframe=true');

BTW, wordpress is open source. You can just look to find the tb_show() function in source and look why something is happening or not. This can help to find out specific stuff. I didn’t do anything else 🙂

Leave a Comment