Graham Slick Graham Slick - 25 days ago 23
Javascript Question

Plugin Error after Wordpress update

My hosting provider automatically updated to 4.5 and it resulted in an error with the Visual Composer plugin.

I DID READ THESE POSTS:
Plugin throwing TypeError after Wordpress 4.5 update

Visual composer doesn't load and gives TypeError: _.template(...).trim is not a function

Uncaught TypeError: $template.get is not a function

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

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


Here is my function:

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()
},


The error seems to be coming from this line:

$template.get(0).attributes


Has anyone figured out how to fix it ?

Thanks for your help

FLX FLX
Answer

Had the same problem with 4.5 update and tried everything I found but it was still not working.

Finally, I replaced my theme visual composer plugin (v4.7 something) by a recent one (4.11.2, google js_composer.zip).

I just replaced the entire directory content, it works fine.

Comments