Support » Plugin: HubSpot - CRM, Email Marketing, Live Chat, Forms & Analytics » Do not echo in add_leadin_frontend_scripts

  • Resolved Stanimir Stoyanov

    (@sstoqnov)


    SiteGround Representative

    Hi,

    Your plugin breaks the WP REST API responses, because in /inc/class-leadin.php you are printing the following:

    echo '<!-- HubSpot WordPress Plugin v' . LEADIN_PLUGIN_VERSION . ': embed JS disabled as a portalId has not yet been configured -->';

    Please remove that line, because it’s printed in every rest response and we get
    SyntaxError: Unexpected token < in JSON at position 0 SyntaxError: Unexpected token < in JSON at position 0, because that line is printed before the json.

    It’s not a good idea to print something, when using wp_enqueue_scripts hook.

    Please use any other hook like wp_add_inline_style or admin_head.

    Regards,
    Stanimir

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Do not echo in add_leadin_frontend_scripts’ is closed to new replies.