Title: [FIX] nodes[i].parentNode.href is undefined
Last modified: August 22, 2016

---

# [FIX] nodes[i].parentNode.href is undefined

 *  [Rick Mac gillis](https://wordpress.org/support/users/cozylife/)
 * (@cozylife)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/fix-nodesiparentnodehref-is-undefined/)
 * Disqus is isn’t checking to see if the parent node has an href attribute before
   it tries to utilize it. To correct this issue, open /wp-content/plugins/disqus-
   comment-system/media/js/count.js. The code should read as follows.
 *     ```
       var disqus_shortname = countVars.disqusShortname;
       (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('data-dsqidentifier'));
       			if (nodes[i].parentNode.href) {
       				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 = '//' + disqus_shortname + '.disqus.com/count.js';
           (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
       }());
       ```
   
 * Disqus plugin team: Please fix this, for it is broken. 😛 This issue has gone
   unresolved for almost a year now.
 * Also see: [https://wordpress.org/support/topic/uncaught-type-error-cannot-call-method-split-of-undefined?replies=2](https://wordpress.org/support/topic/uncaught-type-error-cannot-call-method-split-of-undefined?replies=2)
 * [https://wordpress.org/plugins/disqus-comment-system/](https://wordpress.org/plugins/disqus-comment-system/)

The topic ‘[FIX] nodes[i].parentNode.href is undefined’ is closed to new replies.

 * ![](https://ps.w.org/disqus-comment-system/assets/icon.svg?rev=1636350)
 * [Disqus Comment System](https://wordpress.org/plugins/disqus-comment-system/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/disqus-comment-system/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/disqus-comment-system/)
 * [Active Topics](https://wordpress.org/support/plugin/disqus-comment-system/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/disqus-comment-system/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/disqus-comment-system/reviews/)

## Tags

 * [typeerror](https://wordpress.org/support/topic-tag/typeerror/)
 * [undefined](https://wordpress.org/support/topic-tag/undefined/)

 * 0 replies
 * 1 participant
 * Last reply from: [Rick Mac gillis](https://wordpress.org/support/users/cozylife/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/fix-nodesiparentnodehref-is-undefined/)
 * Status: not resolved