Skip Navigation

Uncaught TypeError when using a Custom Quicktag on WordPress editors (including Toolset Editors)

Won't fix

Reported for: Toolset Views 2.5.1

Symptoms

Using custom quicktags on Toolset editors (Content Template, View Loop, etc.) does not work properly and produces the following JavaScript error:

Uncaught TypeError: Cannot read property 'split' of undefined

This happens when adding custom quicktags or using a plugin like Post Snippets (which also adds custom quicktags for inserting its own snippets).

Here is a code example that creates a quick tag and triggers the above error:

Adding Quicktags
// Add Quicktags
function custom_quicktags() {?>
    <div id="dialog" title="Dialog Title">I'm in a dialog</div>
    <script type="text/javascript">
        function my_post_snippets() {
            jQuery(document).ready(function() {
                jQuery("#dialog").dialog();
            });
        }
        
        QTags.addButton( 'id1', 'My thing', my_post_snippets, '', '', '',  );
    </script><?php
}
add_action( 'admin_print_footer_scripts', 'custom_quicktags' );

Workaround

Leave
a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>