Currently qTranslate and Advanced Custom Fields do not play well together. The problem is specifically that the WYSIWYG field created by ACF does not allow media to be inserted into it. (A larger problem is that the editors it creates cannot be translated in the same way as the main editor, but I've spent several hours looking into it and qTranslate is quite stubbornly designed for one single "content" instance.) So I found that the problem is that qTranslate is prefixing the wpActiveEditor variable with "qtrans_textarea" for every wp-editor-wrap class in qtrans_wpActiveEditorOverload, and because the ACF editors have this class, the media is attempted to be inserted into the object with the ID qtrans_textarea_fields[xxxxxx], and such a thing does not exist. All of that to say, here's a patch which fixes the error by forcing qTranslate to only add the prefix in the case where it is the "content" editor, which is the only one the rest of the code cares about anyways.
- Code: Select all
Index: qtranslate_javascript.php
===================================================================
--- qtranslate_javascript.php (revision 565448)
+++ qtranslate_javascript.php (working copy)
@@ -236,7 +236,11 @@
$q_config['js']['qtrans_wpActiveEditorOverload'] = "
jQuery('.wp-editor-wrap').unbind('mousedown');
jQuery('.wp-editor-wrap').mousedown(function(e){
- wpActiveEditor = 'qtrans_textarea_'+this.id.slice(3, -5);
+ var sliced = this.id.slice(3, -5);
+ if (sliced == 'content')
+ wpActiveEditor = 'qtrans_textarea_content';
+ else
+ wpActiveEditor = sliced;
});
";
