• On many pages throughout WordPress, this plugin is causing a JS Error (QTags)

    On non-editor pages across the WordPress admin pages (for example, the Plugins page), I get a JavaScript error as a result of this plugin: plugins.php:1699 Uncaught ReferenceError: QTags is not defined.

    This error comes from the following block of code:

    
    <script type="text/javascript">QTags.addButton( 'btn1', 'Advisories and Contact', '<div class="hide-wrapper">[expand title="Advisories & Contact"]', '[/expand]</div>' );
       QTags.addButton( 'btn2', 'Post Image', '[post_thumbnail size="large"]', '' );   
    

    The solution is to add a check that first checks if QTags is a variable defined on that page before continuing on to call QTags.addButton(...).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter parkerboe

    (@parkerboe)

    Please fix this bug!

    I think the plugin creator gave up a while ago.
    I solved this issue by changing the below lines in visual-editor-custom-buttons.php (1088 to 1100)

       if ($radio == "wrap") {
       $content .= "QTags.addButton( 'btn".$count."', '".$tagtitle."', '".$left_tag."', '".$right_tag."' );
       ";
       } else {
    	$content .= "QTags.addButton( 'btn".$count."', '".$tagtitle."', '".$block_content."', '' );   
    	";
       }
       endif;
     endwhile; 
    	
    	$content .= "
    
        QTags.addButton( 'tag', 'Link Tag', prompt_user );
    

    to

       if ($radio == "wrap") {
       $content .= "if ( typeof QTags != 'undefined' ) {QTags.addButton( 'btn".$count."', '".$tagtitle."', '".$left_tag."', '".$right_tag."' )};
       ";
       } else {
    	$content .= "if ( typeof QTags != 'undefined' ) {QTags.addButton( 'btn".$count."', '".$tagtitle."', '".$block_content."', '' )};   
    	";
       }
       endif;
     endwhile; 
    	
    	$content .= "
    
        if ( typeof QTags != 'undefined' ) {QTags.addButton( 'tag', 'Link Tag', prompt_user )};
    
    Thread Starter parkerboe

    (@parkerboe)

    For anyone looking for the specifics of what changed, see this diff check: https://www.diffchecker.com/yp6N7iOD

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Bug Report: JS Error in WP Admin pages’ is closed to new replies.