Resources     Blog  

  1. Home
  2. WordPress Tutorials
  3. How to Stop Disqus from Overriding the WordPress Comment Count

How to Stop Disqus from Overriding the WordPress Comment Count

Are you looking for a way to stop overriding the WordPress comment count from Disqus? The comments section in WordPress gives your visitors an opportunity to share their opinion about your content. While the default comments section will be more than enough for many websites, others will choose to install Disqus instead.

Disqus is a very popular comment system that can give you complete control over your comments section. It has many benefits in comparison to using the default comments section including better spam protection, but it will override the WordPress comment count. Today, I will demonstrate how to stop overriding the WordPress comment count from Disqus using two methods.

What Does Overriding the Comment Count Do

WordPress allows you to choose the exact amount of comments you want to display on a page. This is to prevent slow loading times on pages that have thousands of comments. On top of loading the page content, you also need to load all of the comments, any images, GIFs, or attachments and their avatars/Gravatars.

Instead of loading thousands of comments you will only load 50, 100, or another number of your choice. This is extremely common on larger websites, but when you install Disqus, there is a solid chance it will override the comment count you chose. If this does happen you will most likely see a «View Comments» text instead of the comments loading.

While this will actually result in better load times for the page, it is something you did not select. As a web developer, it is very important to be in control of your website and sometimes that means changing a few lines of code to stay in control.

How to Stop Overriding the WordPress Comment Count from Disqus

Today, I will demonstrate how to stop overriding the WordPress comment count from Disqus using two methods. The first method involves locating an advanced setting of Disqus called «Render Comments JavaScript.» This setting will typically fix the issue if comments are not displaying on your website. However, its success is based entirely on the theme you are using.

If the first method doesn’t work, you will need to add a few lines of code into your functions.php file to solve the problem. It’s easy to do at any skill level.

Method 1: Advanced Settings

On the left-hand panel click on Disqus. Click on the Advanced tab to view all available advanced settings.

Locate the Render Comments JavaScript option. Make sure the box is checked.

Click on the «Save» button.

Check your website and see if your comments are loading the way they should be. If so, congratulations. If not, don’t worry, the next method should resolve the problem.

Method 2: Code Approach

Let’s start by logging into the cPanel and clicking on the File Manager option. The File Manager will allow you to access all of the files related to your website.

Click on the File Manager option.

You need to locate your theme’s functions.php file. Click on the public_html directory, then click on the wp-content folder. Inside this folder, you will find all of the content related to your website. Click on the themes folder and enter the folder of the theme you are currently using. Finally, right-click on the functions.php file and select the Edit option.

Select the "Edit" option.

A pop-up window will show up. This box will warn you to create a backup of your files before editing anything. This will ensure that you can revert your website back to when it was working if something goes wrong. Click on the «Edit» button. A new tab will open containing all of the code from the file.

Click on the "Edit" button.

Copy and paste the following lines of code into your functions.php file:

// Fix Disqus Comment Count
remove_filter(‘comments_number’, ‘dsq_comments_text’);
remove_filter(‘get_comments_number’, ‘dsq_comments_number’);
remove_action(‘loop_end’, ‘dsq_loop_end’);

Once you have inserted the code into the functions.php file, click on the «Save Changes» button to finish.

Click on the "Save Changes" button.

This should resolve any problems related to your comments section. There is a chance this code could actually turn off your comments section. If that happens, don’t worry, go to the comment settings and check the box that requires commenters to be registered with a previously approved comment.

Stay in Control

WordPress is the most popular website building platform in the world. It is responsible for 30% of all websites. It is extremely popular because it gives you all of the creative freedom and choices you need as a web developer. When using WordPress, you should always be in complete control of the website. Every plugin has settings you can change and code you can edit.

This means you can create a website to look and function exactly as you intend. With that said, you will still need prior experience to get the best results possible, but WordPress is easy to learn and can be used without ever writing a line of code.

Were you able to stop Disqus from overwriting your comment count? Which method worked for you?

Author: Robert Giaquinto

Robert has been writing tutorials about WordPress and other CMS for over 3 years since joining the GreenGeeks marketing team. Thanks to this, he has had the opportunity to research and master several areas of WordPress including plugin usage, SEO, website design, and social media integration. When he is not creating content for WordPress, Robert is digging up new content ideas for environmental pieces. These range from the pollution in our air to the danger’s wildlife face. And with a bachelor’s degree in electrical engineering, he is always eager to discuss the way our technologies are affecting the environment, especially when it comes to solar energy.

Was this article helpful?

Related Articles

Leave a Comment

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.