Conditional add_filter?

From the looks of your code, clicking on the #customAttachments field is firing a jQuery event that calls a tb_show() method to load the media-upload.php file with certain GET parameters already set (post_id, type, TB_iframe). What you could do is add another GET parameter and check if that’s set in order to execute your add_filter() code.

So:

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

Becomes:

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

Then you can use:

if(isset($_GET['myMarker'])){
    add_filter("attachment_fields_to_save", "rt_image_attachment_fields_to_save", null , 2);
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)