Title: Disqus plugin adding code to JSON API feed
Last modified: August 19, 2016

---

# Disqus plugin adding code to JSON API feed

 *  [joshcanhelp](https://wordpress.org/support/users/joshcanhelp/)
 * (@joshcanhelp)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/disqus-plugin-adding-code-to-json-api-feed/)
 * The JSON API plugin is working great but I ran into a problem when trying to 
   combine with the Disqus plugin. When the plugin is activated, a block of HTML
   is added to the JSON feed and causing it to break the elements using this feed.
   Here’s what’s added:
 *     ```
       <script type="text/javascript">
       	// <![CDATA[
       		var disqus_shortname = 'something';
       		var disqus_domain = 'disqus.com';
       		(function () {
       			var nodes = document.getElementsByTagName('span');
       			for (var i = 0, url; i < nodes.length; i++) {
       				if (nodes[i].className.indexOf('dsq-postid') != -1) {
       					nodes[i].parentNode.setAttribute('data-disqus-identifier', nodes[i].getAttribute('rel'));
       					url = nodes[i].parentNode.href.split('#', 1);
       					if (url.length == 1) url = url[0];
       					else url = url[1]
       					nodes[i].parentNode.href = url + '#disqus_thread';
       				}
       			}
       			var s = document.createElement('script'); s.async = true;
       			s.type = 'text/javascript';
       			s.src = 'http://' + disqus_domain + '/forums/' + disqus_shortname + '/count.js';
       			(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
       		}());
       	//]]>
       	</script>
       ```
   
 * I’m already hacking the plugin a bit to remove body text so I don’t mind making
   changes to the code, just not sure where to start.
 * Also checking with Disqus but I figured modifying this plugin would be easier(
   with less downstream effects, likely).
 * Thanks!

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

 *  Thread Starter [joshcanhelp](https://wordpress.org/support/users/joshcanhelp/)
 * (@joshcanhelp)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/disqus-plugin-adding-code-to-json-api-feed/#post-1813738)
 * For anyone having this issue…
 * I contacted Disqus support and there is an option for Disqus called “Output Javascript
   in footer.” Go to Comments > Disqus and look on the top right for Advanced Options.
   Click that and check the box for this option. You’ll need to have wp_footer()
   in footer.php but this stops putting it in the header.
 *  Plugin Author [dphiffer](https://wordpress.org/support/users/dphiffer/)
 * (@dphiffer)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/disqus-plugin-adding-code-to-json-api-feed/#post-1813759)
 * Thanks for the heads up Josh. I found another workaround that will make its way
   into the next release. Adding this into JSON_API_Response::setup prevents Disqus
   from getting up in my business:
    `remove_action('loop_end', 'dsq_loop_end');`
 *  Thread Starter [joshcanhelp](https://wordpress.org/support/users/joshcanhelp/)
 * (@joshcanhelp)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/disqus-plugin-adding-code-to-json-api-feed/#post-1813760)
 * Thanks for the reply… that’s a good addition.

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

The topic ‘Disqus plugin adding code to JSON API feed’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/json-api.svg)
 * [JSON API](https://wordpress.org/plugins/json-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-api/)
 * [Active Topics](https://wordpress.org/support/plugin/json-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-api/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [joshcanhelp](https://wordpress.org/support/users/joshcanhelp/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/disqus-plugin-adding-code-to-json-api-feed/#post-1813760)
 * Status: not resolved