Plugin throwing TypeError after WordPress 4.5 update

后端 未结 10 1419
甜味超标
甜味超标 2020-12-07 19:06

I\'m debugging a visual composer plugin that broke after I updated WordPress to 4.5 and I can\'t figure out why it is throwing a TypeError.

The error message in the

10条回答
  •  情歌与酒
    2020-12-07 19:15

    @Ben This works perfect!

    Cause: Admin was not loading the correct visual editor for js_composer plugin after updatethis plugins.

    =====================================================

    Error:

    Error: TypeError: $template.get is not a function Source File: wp-content/plugins/js_composer_salient/assets/js/dist/backend.min.js?ver=4.10 Line: 4047

    =====================================================

    Solution Goto file /wp-content/plugins/js_composer_salient/assets/js/dist/backend.min.js around line 4045:

    ======> Replace the code =====================================================

        html2element: function(html) {
            var $template, attributes = {};
            _.isString(html) ? (this.template = _.template(html), $template = $(this.template(this.model.toJSON(), vc.templateOptions["default"]).trim())) : (this.template = html, $template = html), _.each($template.get(0).attributes, function(attr) {
                attributes[attr.name] = attr.value
            }), this.$el.attr(attributes).html($template.html()), this.setContent(), this.renderContent()
        },
    

    ======> Replace with this 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()
        },
    

提交回复
热议问题