How To Add Giscus To Your WordPress Site

So you have a WordPress blog and now you need a commenting solution. You could use the default WordPress commenting system or something based on it, but it interferes with your amazing caching solution. So you turn to Disqus, but that too has several problems. Not only has the plugin not been updated in a while, but the actual commenting solution is notorious for slowing down sites, in addition to the forced ads that add even more load time. You need something off-site that won’t slow down your site.

Enter Giscus.

Giscus is a commenting solution that uses Github Discussions as its backend. Unlike Disqus, it’s completely free, supports lazy loading out of the box, and has no ads while supporting rich text via markdown and moderation features.

The first thing we’ll need is the WPCode plugin. This plugin will allow us to add HTML and disable comments without having to edit functions.php. Next, go to the “+Add A Snippet” screen and add the “Completely Disable Comments” snippet. Now add a new custom snippet.

Before we add the new HTML snippet, we need to set up Giscus. Go to giscus.app and fill out the Configuration form. Note that you need a GitHub account and discussions enabled on a public repository. At the bottom you’ll see a script block. This is what we’re going to use.

Copy This

Go back to the snippet page and paste the script block into the “Code Preview” text box. Make sure the “Code Type” is set to “HTML Snippet”. Next, select “Insert After Post” for “Location”.

Now scroll down to “Smart Conditional Logic” and check “Enable Logic”. Here we can choose where we want Giscus to appear, as by default it will appear on all posts and pages. In this case we only want it to appear on posts. To do this, set the three drop-down boxes to “Post type”, “is”, and “Posts” respectively. Now save the snippet and activate it.

You can add more conditions if needed.

And that’s it. There’s more you can do with Giscus, like enabling custom themes, but that’s beyond the scope of this guide.