Title: TinyMCE Shortcode button fix
Last modified: August 22, 2016

---

# TinyMCE Shortcode button fix

 *  Resolved anonymized-14087207
 * (@anonymized-14087207)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/tinymce-shortcode-button-fix/)
 * Hi,
 * I fixed the issue with the shortcode button in the visual editor for newer wordpress
   versions. I hope Will Zachmann could implement it in the next version 🙂
 * There are other issues that come with the visual editor (TinyMCE) because the
   functions get updated sooner or later and break older plugins. I just focused
   on the issue with the shortcode insert button.
 * Open the **shortcode-exec-php-class.php** in the plugin-folder and scroll to 
   this js-part (about line 1189):
 *     ```
       $('#scep-tinymce-form').submit(function() {
           if (window.tinyMCE) {
               window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, '[' + $('#scep-tinymce-shortcode').val() + ']');
       	tinyMCEPopup.editor.execCommand('mceRepaint');
       	tinyMCEPopup.close();
           }
           return false;
       });
       ```
   
 * Change it this way and save it:
 *     ```
       $('#scep-tinymce-form').submit(function() {
           if (window.tinyMCE) {
               if (tinyMCE.majorVersion>="4") {
                   window.tinyMCE.execCommand('mceInsertContent', false, '[' + $('#scep-tinymce-shortcode').val() + ']');
               } else {
                   window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, '[' + $('#scep-tinymce-shortcode').val() + ']');
               }
               tinyMCEPopup.editor.execCommand('mceRepaint');
       	tinyMCEPopup.close();
           }
           return false;
       });
       ```
   
 * That’s all 😉
 * [https://wordpress.org/plugins/shortcode-exec-php/](https://wordpress.org/plugins/shortcode-exec-php/)

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/tinymce-shortcode-button-fix/#post-5785857)
 * Because of a holiday I am just seeing this message now.
    I will update the plugin
   today with this change. Thanks for fixing this!

Viewing 1 replies (of 1 total)

The topic ‘TinyMCE Shortcode button fix’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/shortcode-exec-php.svg)
 * [Shortcode Exec PHP](https://wordpress.org/plugins/shortcode-exec-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcode-exec-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcode-exec-php/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcode-exec-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcode-exec-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcode-exec-php/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [M66B](https://wordpress.org/support/users/m66b/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/tinymce-shortcode-button-fix/#post-5785857)
 * Status: resolved