disqus / disqus-wordpress-plugin

WordPress plugin for Disqus (Latest version)
https://disqus.com/
34 stars 25 forks source link

Check for container ID before adding embed script #98

Closed tterb closed 3 years ago

tterb commented 3 years ago

Description

Added a check for the Disqus container before adding the embed script to the page.

Motivation and Context

WP report I have a strong feeling that this issue is only happening when something in the WordPress theme or site is misconfigured that's causing pages to pass our other conditions because I couldn't reproduce the issue on the test site and the issue is only being reported for a couple of sites. If you look at one of the sites listed in the report thread, you can see that there's a /wp-content/plugins/disqus-comment-system/public/js/comment_embed.js?ver=3.0.21 script on the page that shouldn't be added to pages that don't have comments. This is causing the rest of the plugin to think that we should go forward with adding the embed script, even though we don't have a disqus_thread element to load the thread into.

Someone with more WordPress knowledge could probably find a better solution.

How Has This Been Tested?

Tested locally with the WP test site

Types of changes

Checklist:


This change is Reviewable