How to Disable Disqus on Custom Post Types in WordPress

Do you need to disable Disqus comments on custom post types in WordPress?

Sometimes, comments may disappear from your custom post types after switching to Disqus. This happens when your comments aren’t migrated properly, but thankfully there’s a quick and easy fix.

In this article, we will show you how to disable the Disqus comment system on custom post types in WordPress.

Why We Switched Away From Disqus

In the past, we experimented with using the Disqus comment system on WPBeginner. However, we quickly switched back to the built-in WordPress comment system.

There were several reasons why we switched away from Disqus, but early on, we noticed some comments weren’t appearing on our custom post types after moving to Disqus.

If you are still using Disqus to manage and moderate comments in WordPress, then one solution is to import these comments manually. However, this can take a lot of time and effort, particularly if your custom posts have a lot of comments.

Thankfully, there is a faster workaround for Disqus users. With that in mind, let’s see how you can quickly and easily disable Disqus for custom post types.

Disabling Disqus on Custom Post Types in WordPress

Before getting started, you need to make sure you have enabled syncing between Disqus and your WordPress website.

In the left-hand menu, select Disqus and then click on the ‘Syncing’ tab. You can then click on ‘Enable Auto Syncing’ if it’s not already activated.

Make Sure You Have Enabled Syncing Between Disqus and WordPress

Note: At this point, you may see the following error: “You must have a Site Shortname, API Secret Key, and API Access Token configured to enable this feature.” If this happens, then we will show you how to fix the error at the end of the post.

After that, you will need to add some code to your WordPress blog.

Often, tutorials will ask you to edit your theme files directly, but we don’t recommend this approach, as a small mistake could cause a number of common WordPress errors or even break your site completely.

With that being said, we recommend using the free WPCode plugin instead. It is the easiest and safest way to add custom code in WordPress.

Upon activation, go to Code Snippets » Add Snippet in your WordPress dashboard.

Here, you will see all the different ready-made snippets that you can add to your site. These include snippets that allow you to disable widget blocks in WordPress and remove the WordPress version number.

To add your own snippet, hover over ‘Add Your Custom Code’ and then click ‘Use snippet.’

On this screen, type in a title for the custom code snippet. This can be anything that helps you identify the PHP snippet.

Next, simply open the ‘Code Type’ dropdown and select ‘PHP Snippet.’

After that, just paste the following snippet into the code editor:

123456789101112functionfilter_dsq_can_load( $script_name) {if( is_singular( 'custom_post_type_name') ) {if( 'count'=== $script_name) {returnfalse;} elseif( 'embed'=== $script_name) {returnfalse;} else{returntrue;}}}add_filter( 'dsq_can_load', 'filter_dsq_can_load');

Hosted with ❤️ by WPCode

1-click Use in WordPress

This code creates a filter that checks for a specific custom post type and then disables the Disqus comment template.

With that in mind, make sure you replace custom_post_type_name with the name of the custom post type where you want to disable Disqus.

Below the code box, you will see the insertion options. If it isn’t already selected, then click on the ‘Auto Insert’ method so the snippet will be automatically inserted and executed across your entire WordPress blog.

After that, open the ‘Location’ dropdown and click on ‘Run Everywhere.’

Then, scroll to the top of the screen and click on the ‘Inactive’ toggle so it changes to ‘Active.’

Finally, go ahead and click on ‘Save’ to make the Disqus snippet live.

Troubleshooting: You Must Have a Site Shortname, API Secret Key, and API Access Token

When you try to enable the Disqus auto syncing, you may get an error: “You must have a Site Shortname, API Secret Key, and API Access Token configured to enable this feature.”

If this happens, then you will need to create a Disqus application by heading over to the Disqus website. If you haven’t already, then you can create a free account using your email address or sign in using another account, such as your Facebook or Twitter account.

With that done, click on the ‘Registering an application’ link.

On this screen, you can type in some information about your application, such as its name, your organization, and the website where you plan to use Disqus.

When you are happy with the information you have entered, just click on ‘Register my application.’

With that done, scroll to the ‘Default Access’ section.

You can now choose ‘Read, write, and manage forums’ from the dropdown menu.

After that, scroll to the bottom of the screen and click on ‘Save Changes.’

You can now click on the ‘Details’ tab.

After that, scroll to the ‘OAuth Settings’ section.

Here, you will find the API key, API secret, and access token. You will need to add this information to the Disqus plugin settings.

In the WordPress dashboard, select Disqus from the left-hand menu.

Then, click on the ‘Site Configuration’ tab.

On this screen, you need to select the ‘Click to make changes’ link.

You can now add the API key, API secret, and access token into the different fields. You will also need to add your site’s shortname if you haven’t done this already.

With that done, click on the ‘Save’ button.

Now, if you select the ‘Syncing’ tab, then you should see a new ‘Enable Auto Syncing’ button instead of an error.

We hope this tutorial helped you learn how to disable Disqus on custom post types in WordPress. You may also want to learn how to increase your blog traffic and see our expert picks for the best social media plugins for WordPress.

Do you need to disable Disqus comments on custom post types in WordPress? Sometimes, comments may disappear from your custom post types after switching to Disqus. This happens when your comments aren’t migrated properly, but thankfully there’s a quick and easy fix. In this article, we will show you how…

Do you need to disable Disqus comments on custom post types in WordPress? Sometimes, comments may disappear from your custom post types after switching to Disqus. This happens when your comments aren’t migrated properly, but thankfully there’s a quick and easy fix. In this article, we will show you how…

Leave a Reply

Your email address will not be published. Required fields are marked *