How to Disable Disqus Comments on Custom Post Types in WordPress (2023)

Hey there, WordPress user! Are you currently using the Disqus commenting system on your website? If so, you may have run into a scenario where you want to disable Disqus comments on certain custom post types.

Perhaps you have a custom post type for team member bios or product pages where comments aren‘t necessary or appropriate. Or maybe you‘ve noticed that Disqus isn‘t integrating smoothly with a particular custom post type, leading to duplicate or missing comments.

As a WordPress developer, I‘ve seen these issues crop up for many clients. The good news is that selectively disabling Disqus comments on custom post types is quite straightforward. In this guide, I‘ll walk you through exactly how to turn off Disqus for specific post types using a simple code snippet.

We‘ll be diving into some PHP, but don‘t worry – I‘ll break it down step-by-step with plenty of visuals. You‘ll also learn the proper way to add custom code snippets to your WordPress site without risking a dreaded white screen of death.

Let‘s jump in!

Why You Might Want to Disable Disqus Comments on Certain Post Types

Before we start tweaking code, let‘s discuss some of the common reasons you would want to disable Disqus comments for particular WordPress post types:

1. Streamlining the User Experience

Think about a custom post type like "Portfolio" or "Team" on a business website. Chances are, having a comments section on those pages doesn‘t add much value for visitors. In fact, it could even distract from the main content.

By disabling Disqus comments strategically, you can provide a cleaner, more focused user experience. Visitors can easily find the info they need without wading through unrelated discussions.

2. Preventing Duplicate or Lost Comments

One of the most frustrating Disqus issues I see is when comments seem to disappear or not sync properly, especially on custom post types. Users may try to leave a comment, but it never shows up. Or the same comment might appear multiple times.

These glitches are confusing for your audience and can discourage them from engaging with your site. If you notice persistent syncing problems on a post type, it may be better to disable Disqus comments entirely to avoid a buggy experience.

3. Improving Page Load Speed

Did you know that slow-loading websites cost retailers $2.6 billion in lost sales every year? While Disqus offers advanced features, it can also slow down your pages, particularly if a post has a lot of comments.

For any custom post type where dynamic conversations aren‘t essential, like a "Resources" or "FAQ" section, disabling Disqus can give your page load times a boost. Even a 1 second delay can impact your conversions, so it‘s worth optimizing where you can.

4. Flexibility to Use Other Comment Systems

You may prefer to use native WordPress comments or another plugin like wpDiscuz on certain custom post types. With Disqus disabled on that post type, you‘re free to mix and match different commenting solutions across your site.

I‘ve had clients use Disqus on their blog, native WP comments on core pages, and no comments on portfolio items. This hybrid approach can be the sweet spot for many sites. It‘s all about catering to your unique audience needs.

How to Properly Turn Off Disqus Comments on WP Custom Post Types

Now for the actionable steps! There are two main ways to disable Disqus comments for WordPress custom post types:

  1. Using a code snippet (recommended)
  2. Using a plugin

I typically recommend the code snippet method, as it offers more control and has less overhead than adding another plugin. However, I‘ll walk through both options so you can decide what‘s right for your site.

Option 1: Disable Disqus Comments with Code

By adding this PHP snippet to your WordPress site, you can surgically disable Disqus comments only on the custom post types you specify. The comments will still load normally everywhere else.

Here‘s how to do it:

Step 1: Make sure Disqus syncing is enabled

First, navigate to the Disqus settings in your WordPress dashboard and click on the "Syncing" tab. Verify that syncing is enabled between Disqus and your WordPress site.

If you see an error message about API keys, don‘t panic. I‘ll explain how to resolve that later in the troubleshooting section.

Step 2: Add the code snippet

Now, you‘ll add this code to your WordPress site:

function filter_dsq_can_load( $script_name ) {
  if ( is_singular( ‘custom_post_type_name‘ ) ) {
    if ( ‘count‘ === $script_name ) {
      return false;
    } elseif  ( ‘embed‘ === $script_name ) {
      return false;
    } else {
      return true;
    }
  }
}
add_filter( ‘dsq_can_load‘, ‘filter_dsq_can_load‘ );

Make sure to replace custom_post_type_name with the actual name of your post type. For instance, if you want to disable Disqus on a "portfolio" post type, it would be is_singular( ‘portfolio‘ ).

It‘s tempting to just paste this directly into your theme‘s functions.php file. However, that‘s risky. One small PHP error can completely break your site.

Instead, I strongly recommend using a plugin like Code Snippets or WPCode to add snippets. It‘s much safer. For this tutorial, we‘ll use the free WPCode plugin.

Once you‘ve installed WPCode, go to Code Snippets > Add New in your WordPress admin panel. Give your snippet a name, choose "PHP Snippet", and paste in the code.

Adding a PHP code snippet in WordPress

Under "Insertion", select "Auto Insert" and "Run Everywhere". Then activate the snippet and click "Save & Activate".

That‘s it! Now Disqus comments will be disabled on single pages for that custom post type only. The comments will still appear as usual on the rest of your site.

Option 2: Disable Disqus with a Plugin

If you‘re not comfortable editing code, you can use a plugin like Disqus Conditional Load to control where Disqus appears.

After installing the plugin, go to Settings > Disqus Conditional Load to configure it. Enter the names of the custom post types you want to exclude from Disqus:

Disqus Conditional Load plugin settings

Save your changes, and Disqus will now be disabled for those post types. Keep in mind that with this method, you can only universally turn off Disqus for a post type. The code snippet allows more granular control if needed.

How to Fix Common Disqus Integration Issues

When setting up Disqus on WordPress, you may encounter some pitfalls, like API key errors or syncing troubles. Let‘s troubleshoot!

Disqus API key errors

If you see a message like "You must have a Site Shortname, API Secret Key, and API Access Token configured to enable this feature", you‘ll need to set up a Disqus API application. Here‘s how:

  1. Go to the Disqus API Applications page and click "+ Register New Application"
  2. Name your app, choose "Website" as the type, and enter your website URL
  3. In the "Settings" tab, set "Default Access" to "Read, Write, and Manage Forums"
  4. Go to the "Details" tab and copy the API Key, API Secret, and Access Token
  5. Paste those values into the Disqus settings in your WordPress admin panel

Syncing issues and missing comments

If comments aren‘t syncing between Disqus and WordPress, try these steps:

  1. In Disqus, go to Admin > Moderation > Sync and click "Resync Comments"
  2. Make sure the Disqus plugin is updated and you‘re using the latest Disqus code
  3. In WordPress, go to Disqus > Import and run the WP comment importer
  4. Check your WordPress "Discussion" settings to ensure commenting is enabled

Plugin and theme conflicts

Disqus may conflict with your WordPress theme or plugins, causing the comment box not to load. To troubleshoot:

  1. Switch to a default WordPress theme like Twenty Twenty-One
  2. Disable all plugins except Disqus
  3. Check if Disqus loads properly now, then re-enable plugins one by one to find the culprit
  4. If the issue is with your theme, contact the theme developer or consider switching themes

Tips for Managing a Thriving Disqus Community

Disqus is a powerful tool for fostering engagement on your WordPress site. To make the most of it, consider these tips:

  • Moderate regularly: Check your Disqus admin panel daily for spam, trolls, or inappropriate comments. Don‘t let a few bad apples ruin the experience for everyone.
  • Respond promptly: When users take the time to leave a thoughtful comment, acknowledge it! Responding quickly makes your audience feel heard and encourages more comments.
  • Lead by example: Set the tone for your community with your own comments. Be respectful, stay on topic, and add value to the conversation.
  • Customize the design: Tweak the Disqus design to match your site‘s branding for a cohesive look. You can change colors, fonts, and layouts in the Disqus settings.
  • Highlight top commenters: Install the Disqus Top Commenters Widget on your site to recognize your most active participants and incentivize engagement.

By creating a welcoming space for discussion, you‘ll turn casual readers into a loyal community.

Removing or Migrating Away from Disqus

If you decide to stop using Disqus on your WordPress site, you‘ll want to properly remove it and migrate your comments. Here‘s a general overview of that process:

  1. Export your Disqus comments by going to Moderation > Export in your Disqus admin panel. Choose the XML format.
  2. Import the XML file to your new commenting system, whether that‘s native WordPress comments or another plugin like wpDiscuz.
  3. Thoroughly test the import to ensure all comments transferred successfully.
  4. Disable the Disqus plugin on your WordPress site. This will remove the Disqus comment box from all posts.
  5. Inform your audience about the change and update your comment policy if needed.

Remember, if you simply deactivate Disqus without migrating the comments first, those comments will disappear from your site. The export step is key for preserving your comment history.

Exploring Disqus Alternatives for WordPress

Not sure if Disqus is the right fit? Here are a few other popular options for WordPress comments:

PluginKey FeaturesPricing
wpDiscuz– Nested comments
– User mentions
– Media embedding
Free, with premium addons
Jetpack Comments– Social login
– Email notifications
– Spam filtering
Free, with paid plans
GraphComment– Reactions and GIFs
– Auto-moderation
– Analytics
Paid plans start at $19/month
Thrive Comments– Upvoting and badges
– Social sharing
– Lazy loading
One-time fee of $39

Consider your specific needs and budget when evaluating alternatives. You may value certain features, like social media integration or advanced moderation tools, more than others.

To help you weigh the options, check out comparison posts like this one from WPBeginner or this one from Blogging Wizard.

You can also mix and match solutions. For instance, you could use Disqus on your blog posts but native WP comments on pages. Think about where each system would be most effective.

Wrapping Up

Well, dear reader, we‘ve covered a lot of ground in this Disqus deep dive. You now know how to disable Disqus comments on specific WordPress custom post types using a code snippet or plugin. We‘ve also looked at troubleshooting common issues, best practices for comment management, and alternative options to consider.

Remember, at the end of the day, your commenting system should enhance the user experience and encourage meaningful engagement. By being strategic about which post types have comments and monitoring them closely, you can cultivate a thriving community around your content.

I hope this guide has empowered you to take control of your site‘s discussions. The comments section doesn‘t have to be a wild west – with the right setup and moderation, it can be a valuable space for connection and feedback.

If you have any lingering questions or tips of your own to share, leave them in the comments below. I‘m always keen to hear about your experiences with Disqus and WordPress. Until next time, happy coding!

Did you like this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.