1

I was asked to look into a problem on a WordPress page that I didn't make. It uses Visual Composer and for a few days they can't add any images to the pages in the backend. The Single Image component loads, you can select the picture, but when you add it nothing happens.

Checking the console it gives the following error:

ReferenceError: id is not defined

in the following location: /wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,jquery-ui-slider,jquery-tou&load%5B%5D=ch-punch,iris,wp-color-picker,jquery-ui-sortable,underscore,wp-a11y,thickbox,shortcode,plupload,jquery-ui-position,jquery-ui-men&load%5B%5D=u,jquery-ui-autocomplete,jquery-ui-tabs,farbtastic,media-upload&ver=4.5.2 line 98 > Function

var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
with(obj||{}){
__p+='\n    <li class="added">\n        <div class="inner" style="width: 75px; height: 75px; overflow: hidden;text-align: center;">\n            <img rel="'+
((__t=( id ))==null?'':__t)+
'" src="'+
((__t=( url ))==null?'':__t)+
'" />\n        </div>\n        <a href="#" class="icon-remove"></a>\n    </li>\n';
}
return __p;

Tried to fix it by this, this, this and this solution, but nothing worked.

András Hideg
  • 21
  • 1
  • 3

3 Answers3

1

I encountered this error today. It's caused by updating to wordpress 4.5, which includes a new version of jquery which is incompatible with this old version of visual composer.

I was able to fix this by updating to a newer version of visual composer, which I found from this answer: https://stackoverflow.com/a/37138448

Community
  • 1
  • 1
Bob Dole
  • 19
  • 1
  • Thanks for the quick reply. I downloaded the new version of visual composer, uploaded to the theme's plugin folder, but now it gives a white screen of death. In the php log the following error is shown: Jun 9 13:28:44 PHP Fatal error: Call to a member function init() on a non-object in /public_html/wp-content/themes/123medicine/functions.php on line 161 Line 160-161 in functions.php is require_once locate_template('/wpbakery/js_composer/js_composer.php'); $wpVC_setup->init($composer_settings); I guess I need to make the initialization in an other way, but how? – András Hideg Jun 09 '16 at 10:36
  • 1
    For my theme I was able to simply delete the wp-content/plugins/js_composer directory and unzip the replacement. I'm not sure how it's initialized by my theme, but I didn't have to do anything extra. It sounds like your theme has visual composer baked in, rather than living in the plugins directory. You may want to read this: http://canatech.ca/kb/wp/kb-wordpress-registering-visual-composer/ – Bob Dole Jun 09 '16 at 18:00
  • Yes, Visual Composer is baked in. I checked the function.php, I got the exact same init code there. – András Hideg Jun 09 '16 at 23:29
1

I also had the same problem today with a friend who created her own website in wordpress, updated wordpress and stopped working Visual Composer. To resolve the issue quickly, I have modified the media-editor.js file, row 144 (media.VcSingleImage, set function) I have replaced this row:

this.$img_ul.html(_.template($('#vc_settings-image-block').html(), selection));

with

this.$img_ul.html("<li class='add ui-sortable-handle'><img rel='"+selection.id+"' src='"+selection.url+"' > <a href='#' class='icon-remove'></a> </li>");

Let's mention that at version Visual Composer is: 4.7.4

0

My friend had the same problem but with customized visual composer for Salient theme. I created full wp backup, enabled default theme, deleted Salient theme, downloaded zip file with original theme (from themeforest.net where he purchased it) and uploaded it in the Appearance / Themes / Add new / Upload theme view and enabled Salient Visual Composer plugin in the Plugins area...

Sašo Kovačič
  • 891
  • 1
  • 9
  • 21