{"id":19040424,"date":"2026-10-09T02:18:25","date_gmt":"2026-10-09T02:18:25","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/elementormodules-is-not-defined\/"},"modified":"2026-10-09T02:18:25","modified_gmt":"2026-10-09T02:18:25","slug":"elementormodules-is-not-defined","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/elementormodules-is-not-defined\/","title":{"rendered":"elementorModules is not defined"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I added the following code to <code>functions.php<\/code> to defer all JavaScript except for <code>\/wp-content\/plugins\/elementor\/assets\/js\/frontend.min.js<\/code>, and it worked fine.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (!(is_admin() )) {<br>    function my_defer_js( $tag, $handle, $src ) {<br>        if ( FALSE === str_contains( $src, '.js' ) ) return $tag;<br>        if ( str_contains( $src, 'js\/frontend.min.js' ) ) return $tag;<br>        $tag = '&lt;script src=\"' . esc_url( $src ) . '\" defer charset=\"UTF-8\" id=\"' . esc_attr( $handle ) . '-js\"&gt;&lt;\/script&gt;';<br>        return $tag;<br>    }<br>    add_filter( 'script_loader_tag', 'my_defer_js', 10, 3 );<br>}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">However, after updating Elementor to 4.3.0 or later, the following error started appearing in the console:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>frontend.min.js?ver=4.3.4:1 Uncaught ReferenceError: elementorModules is not defined<br>    at frontend.min.js?ver=4.3.4:1:20490<br>    at frontend.min.js?ver=4.3.4:1:151<br>    at frontend.min.js?ver=4.3.4:1:21651<br>    at frontend.min.js?ver=4.3.4:1:151<br>    at frontend.min.js?ver=4.3.4:1:55071<br>    at frontend.min.js?ver=4.3.4:1:151<br>    at frontend.min.js?ver=4.3.4:1:60015<br>    at frontend.min.js?ver=4.3.4:1:60019<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This revealed the following issues:<\/p>\n\n\n\n<ul>\n<li><code>elementor-background-slideshow<\/code> and <code>elementor-widget-image-carousel<\/code> do not work<\/li>\n\n\n\n<li>The <code>e-n-tab-title<\/code> tabs do not switch<\/li>\n\n\n\n<li>When attempting to open the Elementor editor, the message &#8220;The preview could not be loaded&#8221; appears and the editor cannot be opened.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Investigation revealed that the following two additional files must be excluded to prevent them from being deferred:<\/p>\n\n\n\n<ul>\n<li><code>\/wp-includes\/js\/jquery\/jquery.min.js<\/code><\/li>\n\n\n\n<li><code>\/wp-content\/plugins\/elementor\/assets\/js\/frontend-modules.min.js<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Dependencies may have changed in Elementor version 4.3.0 and later.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For your reference.<\/p>\n","protected":false},"template":"","class_list":["post-19040424","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19040424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19040424\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19040424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}