From a3a60d339f76d4484bcd1b661a1effa855e1eba4 Mon Sep 17 00:00:00 2001 From: Alexandros Chatzis Date: Thu, 23 Jun 2022 14:09:06 +0300 Subject: [PATCH] Enqueue inline jQuery code with dependent dependencies jquery and wp_tinymce --- classes/class-cf7rt-rich-text-editor.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/classes/class-cf7rt-rich-text-editor.php b/classes/class-cf7rt-rich-text-editor.php index 888fd81..6a36249 100644 --- a/classes/class-cf7rt-rich-text-editor.php +++ b/classes/class-cf7rt-rich-text-editor.php @@ -91,16 +91,13 @@ public function rich_text_editor_shortcode_handler($tag){ wp_editor( $value, $tag->name,$settings); $rich_editor = ob_get_contents(); - $html = ''.$rich_editor.$validation_error.' - '; - + $html = ''.$rich_editor.$validation_error.''; + + wp_register_script( 'rich-text-editor', '', array("jquery",'wp-tinymce'), '', true ); + wp_enqueue_script( 'rich-text-editor' ); + wp_add_inline_script( 'rich-text-editor',''); + ob_end_clean(); return $html;