Title: Disqus error
Last modified: August 30, 2016

---

# Disqus error

 *  Resolved [chatmandesign](https://wordpress.org/support/users/chatmandesign/)
 * (@chatmandesign)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/disqus-error/)
 * I have both the Disqus comments plugin and Autoptimize installed. When I have
   Autoptimize enabled for JavaScript, Disqus fails.
 * Disqus appears to add these scripts at the bottom of the page:
 *     ```
       <script type='text/javascript'>/*  */
       var embedVars = {"disqusConfig":{"platform":"wordpress@4.3.1","language":""},"disqusIdentifier":"3415 http:\/\/beaconathletics.com\/ballfields\/?p=3415","disqusShortname":"beaconathletics","disqusTitle":"NRPA 2015","disqusUrl":"http:\/\/ballfields.com\/2015\/10\/01\/nrpa-2015\/","options":{"manualSync":false},"postId":"3415"};
       /*  */</script> <script type='text/javascript' src='http://ballfields.com/wp-content/plugins/disqus-comment-system/media/js/disqus.js?ver=4.3.1'></script> <script type='text/javascript'>/*  */
       var countVars = {"disqusShortname":"beaconathletics"};
       /*  */</script> <script type='text/javascript' src='http://ballfields.com/wp-content/plugins/disqus-comment-system/media/js/count.js?ver=4.3.1'></script>
       ```
   
 * When Autoptimize is enabled for JS, I only see the following:
 * `<script type='text/javascript' src='http://ballfields.com/wp-content/plugins/
   disqus-comment-system/media/js/disqus.js?ver=4.3.1'></script>`
 * And I get the following error in the console:
 * `Uncaught ReferenceError: embedVars is not defined`
 * It sounds to me like the problem is due to the in-line script that sets embedVars
   getting concatenated into the main scripts file. Unfortunately, since it’s in-
   line there is no filename to add to the exclusions list. Is there any way to 
   prevent this script from being concatenated?
 * Limiting Autoptimize to scripts in head, as I’ve seen suggested in response to
   similar questions, isn’t really a realistic workaround for me. In keeping with
   generally accepted best practices, nearly all of my scripts are referenced at
   the end of the body, so limiting Autoptimize to the head is not much better than
   disabling it entirely.
 * If there’s not currently a solution for this, is it possible an option to exclude
   all in-line scripts could be added? I realize targeting specific ones would be
   extremely difficult, but it seems like only optimizing scripts loading from file,
   and ignoring in-line ones, should be relatively easy to implement.
 * [https://wordpress.org/plugins/autoptimize/](https://wordpress.org/plugins/autoptimize/)

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

 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/disqus-error/#post-6625282)
 * > Unfortunately, since it’s in-line there is no filename to add to the exclusions
   > list. Is there any way to prevent this script from being concatenated?
 * absolutely, as explained [in the FAQ](https://wordpress.org/plugins/autoptimize/faq/)
   you can also exclude inline script by adding an “identifier string” to the exclusion
   list. in this case `embedVars` would be a good candidate.
 * > If there’s not currently a solution for this, is it possible an option to exclude
   > all in-line scripts could be added?
 * this will become available as an option in the next AO (replacing “look only 
   in head”). until then you can accomplish this with a couple of lines of code (
   adding it to WordPress using e.g. [code snippets](https://wordpress.org/plugins/code-snippets/)):
 *     ```
       add_filter('autoptimize_js_include_inline','support_ao_js_include_inline',10,1);
       function support_ao_js_include_inline() {
               return false;
       }
       ```
   
 * hope this helps,
    frank
 *  Thread Starter [chatmandesign](https://wordpress.org/support/users/chatmandesign/)
 * (@chatmandesign)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/disqus-error/#post-6625345)
 * Ah, perfect! The description on that field implies it has to be a filename, so
   I didn’t realize this was an option. Thanks so much!
 *  Thread Starter [chatmandesign](https://wordpress.org/support/users/chatmandesign/)
 * (@chatmandesign)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/disqus-error/#post-6625346)
 * Resolved.

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

The topic ‘Disqus error’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

## Tags

 * [plugin conflict](https://wordpress.org/support/topic-tag/plugin-conflict/)

 * 3 replies
 * 2 participants
 * Last reply from: [chatmandesign](https://wordpress.org/support/users/chatmandesign/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/disqus-error/#post-6625346)
 * Status: resolved