Title: Cannot read property &#8216;replace&#8217; on undefined
Last modified: December 7, 2016

---

# Cannot read property ‘replace’ on undefined

 *  Resolved [brianpcharles](https://wordpress.org/support/users/brianpcharles/)
 * (@brianpcharles)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/cannot-read-property-replace-on-undefined/)
 * Seeing Console error – Uncaught TypeError: Cannot read property ‘replace’ of 
   undefined in ytprefs.min.js when trying to run a gallery. The iframe at the top
   of the page doesn’t have the data-ep-gallerysrc attribute. The initial video 
   plays fine, but all the thumbnails pull up this error and do nothing. Any suggestions?
 * `var g = c.data("ep-gallerysrc").replace("GALLERYVIDEOID", d).`
 * [http://www.zonediet.com/resources/dr-sears-video-interviews/](http://www.zonediet.com/resources/dr-sears-video-interviews/)
    -  This topic was modified 9 years, 6 months ago by [brianpcharles](https://wordpress.org/support/users/brianpcharles/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [embedplus](https://wordpress.org/support/users/embedplus/)
 * (@embedplus)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/cannot-read-property-replace-on-undefined/#post-8534769)
 * Your theme’s Javascript overrides our plugin’s attempts at using the iframe for
   the gallery. You have a script that revamps the entire iframe here, from line
   269-296:
 * [http://www.zonediet.com/wp-content/themes/zonediet/js/event-tracking.js](http://www.zonediet.com/wp-content/themes/zonediet/js/event-tracking.js)
 * Are you in fact using the functionality in that section of your theme’s script?
   If not, you can take that section out and the gallery should work. If you actually
   are using it, then perhaps your theme developer can make that function a bit 
   less aggressive. It’s currently unnecessarily deleting and recreating your iframe.
 * -EmbedPlus Team

Viewing 1 replies (of 1 total)

The topic ‘Cannot read property ‘replace’ on undefined’ is closed to new replies.

 * ![](https://ps.w.org/youtube-embed-plus/assets/icon-256x256.png?rev=2165403)
 * [Embed Plus for YouTube Gallery, Livestream and Lazy Loading with Facades](https://wordpress.org/plugins/youtube-embed-plus/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/youtube-embed-plus/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/youtube-embed-plus/)
 * [Active Topics](https://wordpress.org/support/plugin/youtube-embed-plus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/youtube-embed-plus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/youtube-embed-plus/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [embedplus](https://wordpress.org/support/users/embedplus/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/cannot-read-property-replace-on-undefined/#post-8534769)
 * Status: resolved