| @@ -52,7 +52,10 @@ | ||
| 52 | 52 | </div> |
| 53 | 53 | |
| 54 | 54 | <script> |
| 55 | 55 | jQuery(document).ready(function($) { |
| 56 | - wp.codeEditor.initialize($('#<?php echo esc_js($field_id);?>' )); | |
| 57 | -}) | |
| 56 | + var editorElem = $('#<?php echo esc_js($field_id);?>'); | |
| 57 | + if (editorElem.length && typeof wp !== 'undefined' && wp.codeEditor && typeof wp.codeEditor.initialize === 'function') { | |
| 58 | + wp.codeEditor.initialize(editorElem[0], {}); | |
| 59 | + } | |
| 60 | +}); | |
| 58 | 61 | </script> |