Title: File Gallery &amp; WPML Javascript Issue
Last modified: August 20, 2016

---

# File Gallery & WPML Javascript Issue

 *  [Devise01](https://wordpress.org/support/users/devise01/)
 * (@devise01)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/file-gallery-wpml-javascript-issue/)
 * Hello,
 * Thank you for creating such a great plugin!
 * I’m currently having an issue with File Gallery with the WPML plugin installed.
   Issue is occurring when File Gallery is attempting to insert the “Copy all attachments
   from this translation ” buttons on the edit post page. If WPML is set to use 
   the translation editor, the error below occurs.
 * **Error:** Uncaught TypeError: Cannot call method ‘pop’ of null
    **Source:** 
   file-gallery.js:1653
 * `var fg_icl_trans_id = Number($(this).attr('href').match(/post=([\d]+)&/).pop());`
 * I placed a breakpoint on this line and the current value of $(this).attr(‘href’)
   is: /admin.php?page=wpml-translation-management/menu/translations-queue.php&job_id
   =49
 * Obviously the URL is different if ‘Use Translation Editor’ is selected in WPML.
   Because of the error a number of interface related issues appear.
 * Personally, I’d be happy for the button not to be there at all if using the translation
   editor.
 * WordPress: 3.5
    WPML: 2.6.1 File Gallery: 1.7.7
 * Your support is much appreciated.
 * Thank you and kind regards,
    Paul
 * [http://wordpress.org/extend/plugins/file-gallery/](http://wordpress.org/extend/plugins/file-gallery/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Devise01](https://wordpress.org/support/users/devise01/)
 * (@devise01)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/file-gallery-wpml-javascript-issue/#post-3286964)
 * My temporary fix:
 * Replaced file-gallery.js:1653 with:
 *     ```
       // FIXED: issue where WPML editor is set to translation editor
       var fg_icl_trans_id = '';
       var fg_icl_trans_match = $(this).attr('href').match(/post=([\d]+)&/);
   
       if (fg_icl_trans_match)
       	fg_icl_trans_id = Number(fg_icl_trans_match.pop());
       ```
   
 *  Plugin Author [Aesqe](https://wordpress.org/support/users/aesqe/)
 * (@aesqe)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/file-gallery-wpml-javascript-issue/#post-3286976)
 * thanks for reporting and supplying a fix! 🙂
 * included in v1.7.8, out soon.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘File Gallery & WPML Javascript Issue’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/file-gallery_fdfbfb.svg)
 * [File Gallery](https://wordpress.org/plugins/file-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/file-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/file-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/file-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/file-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/file-gallery/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [WMPL](https://wordpress.org/support/topic-tag/wmpl/)

 * 2 replies
 * 2 participants
 * Last reply from: [Aesqe](https://wordpress.org/support/users/aesqe/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/file-gallery-wpml-javascript-issue/#post-3286976)
 * Status: not resolved