Plugin Error after Wordpress update
<p>My hosting provider automatically updated to 4.5 and it resulted in an error with the Visual Composer plugin.</p>

<p>I DID READ THESE POSTS:
<a href="https://stackoverflow.com/questions/36605420/plugin-throwing-typeerror-after-wordpress-4-5-update">Plugin throwing TypeError after Wordpress 4.5 update</a></p>

<p><a href="https://stackoverflow.com/questions/36633822/visual-composer-doesnt-load-and-gives-typeerror-template-trim-is-not-a">Visual composer doesn&#39;t load and gives TypeError: _.template(...).trim is not a function</a></p>

<p><a href="https://stackoverflow.com/questions/36641618/uncaught-typeerror-template-get-is-not-a-function">Uncaught TypeError: $template.get is not a function</a></p>

<p>And replaced the html2element function with the one provided. However, as many people commented on these posts, I get a new error:</p>

<pre><code>composer-view.js?ver=4.6.1:139 Uncaught TypeError: Cannot read property 'attributes' of undefined
</code></pre>

<p>Here is my function:</p>

<pre><code>html2element: function(html) {
            var $template, attributes = {},
                template = html;
            $template = $(template(this.model.toJSON()).trim()), _.each($template.get(0).attributes, function(attr) {
                attributes[attr.name] = attr.value
            }), this.$el.attr(attributes).html($template.html()), this.setContent(), this.renderContent()
        },
</code></pre>

<p>The error seems to be coming from this line:</p>

<pre><code>$template.get(0).attributes
</code></pre>

<p>Has anyone figured out how to fix it ?</p>

<p>Thanks for your help</p>