WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
Script Syntax Error: Unexpected token & (2 posts)

  1. sgwatwp
    Member
    Posted 1 year ago #

    Inspecting my admin page with chrome I see there is a script error that is showing up in the console. It says it's at line 239

    setup = function () {
    				$('#wpadminbar').pointer(wpseo_pointer_options).pointer('open');
    									jQuery('#pointer-close').after('<a id="pointer-primary" class="button-primary">' + 'Allow tracking' + '</a>');
    					jQuery('#pointer-primary').click(function () {
    						document.location=&quot;http://mydomain.com/dev12/wp-admin/admin.php?page=wpseo_dashboard&allow_tracking=yes&nonce=36bc1a75fd&quot;;					});

    ^ the last document.location line is 239. So this is happening in part of the wp seo script. I have no other plugins enabled. And of course, when I deactivate WordPress SEO the script error goes away.
    This code appears in my footer.

    My question is, where is this being loaded from? I also had a problem with Titles & Metas not displaying properly, which has not been answered yet. If I knew how scripts were loaded with this plugin maybe I would have a good start on diagnosing the problem, whether it be with my theme or something in WordPress SEO.

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. barticus
    Member
    Posted 1 year ago #

    I believe i have found the problem, although it is not a complete work around, and may not be appropriate in all cases...

    in the file /wp-content/plugins/wordpress-seo/admin/class-pointers.php:

    • change line 233 from <?php echo esc_js( $button2_function ) ; ?> to <?php echo $button2_function ; ?>, and similarly,
    • change line 239 from <?php echo esc_js( $button1_function ); ?> to <?php echo $button1_function ; ?>

    this function changes special characters to HTML character specifiers (i.e " to ") which is what causes this.

    Please note i havent fully tested this so i can't say that it works everywhere in the admin section (which is the only place this is loaded).

    Good Luck!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic