Uncaught TypeError: Cannot read property ‘replace’ of undefined
-
I already contacted the support regarding this bug but have not received a fix. I am posting here seeking help from the community.
On the new version of NextGEN Gallery the following files have been added:
/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/igw.js
/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/igw.min.jsAnd when trying to edit the permalink of an attached image (Media > Library > ‘choose an image that has been attached/uploaded to a page’ > Edit” under “Permalink” click “Edit”, it will not work.
The error displayed is:
Uncaught TypeError: Cannot read property 'replace' of undefined at window.fix_tb_dimensions (https://example.com/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/igw.min.js?ver=2.1.56:1:424) at HTMLDocument.<anonymous> (https://example.com/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/igw.min.js?ver=2.1.56:1:548) at i (https://example.com/wp-includes/js/jquery/jquery.js?ver=1.12.4:2:27449) at Object.fireWith [as resolveWith] (https://example.com/wp-includes/js/jquery/jquery.js?ver=1.12.4:2:28213) at Function.ready (https://example.com/wp-includes/js/jquery/jquery.js?ver=1.12.4:2:30006) at HTMLDocument.K (https://example.com/wp-includes/js/jquery/jquery.js?ver=1.12.4:2:30368)This is the “fix_tb_dimensions” function on “igw.js”:
window.fix_tb_dimensions = function(){ var $button = $('.ngg-add-gallery'); var href = $button.attr('href'); var dimensions = get_igw_dimensions(); href = href.replace(/width=\d+/, 'width='+dimensions.width.toString()); href = href.replace(/height=\d+/, 'height='+dimensions.height.toString()); $button.attr('href', href); }; fix_tb_dimensions();So the “href.replace” here is throwing that exception as far I can understand this.
Please, if you know how to fix this, let us know. Thanks!
The topic ‘Uncaught TypeError: Cannot read property ‘replace’ of undefined’ is closed to new replies.