{"id":14016,"date":"2010-09-09T16:18:45","date_gmt":"2010-09-09T10:48:45","guid":{"rendered":"https:\/\/www.amitbhawani.com\/blog\/?p=14016"},"modified":"2010-09-09T16:18:45","modified_gmt":"2010-09-09T10:48:45","slug":"fix-disqus-problem-duplicate-comments","status":"publish","type":"post","link":"https:\/\/www.amitbhawani.com\/blog\/fix-disqus-problem-duplicate-comments\/","title":{"rendered":"Fix Disqus Problem &#8211; Duplicate Comments after Export &#038; Import"},"content":{"rendered":"<p>The <a href=\"https:\/\/www.amitbhawani.com\/blog\/disqus-comment-forums-system-for-blogs\/\">Disqus commenting system<\/a> is quite good in terms of offering your Blog visitors with a better and easier way to post comments but there are some drawbacks of the same too. One of the biggest one is lack of support from a company which is growing huge and not helping out the users who are struck with problems.<\/p>\n<p>In our case we implemented the <a href=\"https:\/\/www.amitbhawani.com\/blog\/disqus-comment-forums-system-for-blogs\/\">Disqus Commenting System<\/a>, following our article on <a href=\"https:\/\/www.amitbhawani.com\/blog\/quick-tips-reader-comments-increasing-commenting\/\">how to get more blog comments<\/a>, and it was a very quick process. Following this we went ahead with the Exporting of our 20,300 comments which instantly made our server go down and make the blog unavailable for our visitors, which is a very bad deal. No issues within a few minutes we were back and the server load was back to normal.<\/p>\n<p>Next there was no information on the plugin page if the Export was completed or not, nor no information if we should be re-export all our comments back to Disqus which is the reason after a few hours we went ahead to export all our blog comments after disabling most of our other WordPress plugins to make sure the blog resource usage is at its minimum and there is no issue in this one time setup because following this everything will be synced.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/DisQus-WordPress-Duplicate-Comments.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/DisQus-WordPress-Duplicate-Comments-243x300.png?resize=243%2C300\" alt=\"DisQus WordPress Duplicate Comments\" title=\"DisQus WordPress Duplicate Comments\" width=\"243\" height=\"300\" class=\"aligncenter size-medium wp-image-14023\" srcset=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/DisQus-WordPress-Duplicate-Comments.png?resize=243%2C300&amp;ssl=1 243w, https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/DisQus-WordPress-Duplicate-Comments.png?resize=150%2C184&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/DisQus-WordPress-Duplicate-Comments.png?w=507&amp;ssl=1 507w\" sizes=\"auto, (max-width: 243px) 100vw, 243px\" \/><\/a><\/p>\n<p>Once this was done at 100% we found that our comments were not the same 100% levels but were at around ~218% which means that our 20,300 comments became 44,361 comments which is quite a joke. All the blog posts had double the comments with the same stuff just repeating and we went ahead contacting the disqus support through twitter @disqus, @disqushelp and also emailing them comment page screenshot, api information, comments doubling problem at info@disqus.com which was replied after a days time by just asking what the problem is which was already mentioned in the email.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/WordPress-Duplicate-Comments-DisQus.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/WordPress-Duplicate-Comments-DisQus.png?resize=431%2C154\" alt=\"WordPress Duplicate Comments DisQus\" title=\"WordPress Duplicate Comments DisQus\" width=\"431\" height=\"154\" class=\"aligncenter size-full wp-image-14017\" srcset=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/WordPress-Duplicate-Comments-DisQus.png?w=431&amp;ssl=1 431w, https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/WordPress-Duplicate-Comments-DisQus.png?resize=300%2C107&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/WordPress-Duplicate-Comments-DisQus.png?resize=150%2C53&amp;ssl=1 150w\" sizes=\"auto, (max-width: 431px) 100vw, 431px\" \/><\/a><\/p>\n<p>At the same time we were having huge number of visitors and we didn&#8217;t want them to feel that this is a fake blog with duplicated comments, following which we went ahead to the SQL > Phpmyadmin section and started digging into those confusing tables and rows to fix this huge problem. Thanks to Shodan Nayak from <a rel=\"nofollow\" target=\"_blank\" href=\"http:\/\/www.ivps.in\/\">iVPS<\/a> who helped with the right sql queries in order to fix this problem of duplicate comments in the WordPress Blog.<\/p>\n<p>Once you login to the PhpmyAdmin, Under the WordPress database you will find several tables. Here in you will have to click on the &#8216;wp_comments&#8217; table with Type &#8211; MyISAM &#038; Collation &#8211; latin1_swedish_ci. Click on the Browser Icon as shown below.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/WordPress-Comments-Table.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/WordPress-Comments-Table.png?resize=402%2C82\" alt=\"WordPress Comments Table\" title=\"WordPress Comments Table\" width=\"402\" height=\"82\" class=\"aligncenter size-full wp-image-14019\" srcset=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/WordPress-Comments-Table.png?w=402&amp;ssl=1 402w, https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/WordPress-Comments-Table.png?resize=300%2C61&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/WordPress-Comments-Table.png?resize=150%2C30&amp;ssl=1 150w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p>Once you perform this, you will be inside the &#8216;wp_comments&#8217; table, where all the different rows are listed. Most of these rows would be confusing but each of these serve a purpose like storing the comment_author name, comment_author_email for email of commenter &#038; comment_content for the content of the posted comment etc When you Export your comments to Disqus all of these have a specific &#8216;comment_agent&#8217; which is going to give you more information on the service using which the comment was posted. The Disqus based comments would have the information stored in the user-agent field which has to sorted and removed.<\/p>\n<p>Disqus comment_agent Examples :<br \/>\nDisqus\/1.1(2.48):76268969<br \/>\nDisqus\/1.1(2.48):76268228<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/SQL-Query-WordPress-Comments-Table.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/SQL-Query-WordPress-Comments-Table.png?resize=216%2C226\" alt=\"SQL Query WordPress Comments Table\" title=\"SQL Query WordPress Comments Table\" width=\"216\" height=\"226\" class=\"alignright size-full wp-image-14020\" srcset=\"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/SQL-Query-WordPress-Comments-Table.png?w=216&amp;ssl=1 216w, https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/SQL-Query-WordPress-Comments-Table.png?resize=150%2C156&amp;ssl=1 150w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/><\/a>Once you find this and confirm, you can move to the next step of finding out how many of these comments are to be removed and how many of your blog comments are listed under the Disqus user-agent. Click on the SQL Query box and then run the following query which will give you more info.<\/p>\n<p><code>SELECT COUNT(*) FROM wp_comments where comment_agent like 'Disqus%';<\/code><\/p>\n<p>This SQL Query would give you a total number of the comments which are tagged with the user_agent.<\/p>\n<p>The next step would be to to test a few of the comments which are found in the number above to make sure we are proceeding correctly. For this you will have to run the following SQL Query.<\/p>\n<p><code>select * from wp_comments where comment_agent like 'Disqus%' limit 10<\/code><\/p>\n<p>Once everything is perfect, you should first take a Backup of the Comments Table or the whole database. Next run the following query to wipe out of delete all the duplicate comments.<\/p>\n<p><code>delete from wp_comments where comment_agent like 'Disqus%';<\/code><\/p>\n<p>This will give you a result like > 25482 rows affected (2.46 sec), which means that all the comments are removed from your database and if you want to be on the safe side of not deleting all your comments, you can limit the delete query to the specific count which was found earlier.<\/p>\n<p><code>delete from wp_comments where comment_agent like 'Disqus%' limit 25482;<\/code>, following which only the number of comments which you found initially will only be deleted. <\/p>\n<p>This solves the problem partly because there is one more table which is also effected with this plugin and this is the &#8216;wp_commentmeta&#8217; table for which you have to run the following SQL Query to clean all the useless records.<\/p>\n<p><code>SELECT COUNT(*) FROM wp_commentmeta where meta_key like 'dsq_%';<\/code><\/p>\n<p>Now all the remains of disqus are also removed. Just run the <a href=\"https:\/\/www.amitbhawani.com\/blog\/optimize-blog-database-tables-remove-post-revisions\/\">WordPress Optimize plugin<\/a> to clean up everything and enjoy your Blog with the default and the best commenting system.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Disqus commenting system is quite good in terms of offering your Blog visitors with a better and easier way to post comments but there are some drawbacks of the same too. One of the biggest one is lack of support from a company which is growing huge and not helping out the users who [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":20000,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[376],"tags":[],"class_list":{"0":"post-14016","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-wordpress","8":"entry"},"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/12\/DisQus-WordPress-Duplicate-Comments-243x300.png?fit=243%2C300&ssl=1","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":134,"url":"https:\/\/www.amitbhawani.com\/blog\/disqus-comment-forums-system-for-blogs\/","url_meta":{"origin":14016,"position":0},"title":"Disqus Comment Forums System for Blogs","author":"Amit Bhawani","date":"October 31, 2007","format":false,"excerpt":"Disqus is a service developed by Big Head Labs from San Francisco which was founded by Daniel Ha and Jason Yan. It is a blog forum where you can discuss on the topics of your blogs and reply to other commentors. Features of Disqus : Forum backend \u2014 Expand discussions\u2026","rel":"","context":"In &quot;Wordpress Guide&quot;","block_context":{"text":"Wordpress Guide","link":"https:\/\/www.amitbhawani.com\/blog\/category\/wordpress\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":13897,"url":"https:\/\/www.amitbhawani.com\/blog\/quick-tips-reader-comments-increasing-commenting\/","url_meta":{"origin":14016,"position":1},"title":"Best Tips to Get Blog Reader Comments &#038; Increasing Commenting","author":"Amit Bhawani","date":"September 6, 2010","format":false,"excerpt":"There are millions of blogs out there and most of them are based on the Most Popular CMS WordPress in the Blogosphere, which is easy to use and handle. Once your blog is established one big requirement would be to get readers to your blog and increase the discussions on\u2026","rel":"","context":"In &quot;Blogging&quot;","block_context":{"text":"Blogging","link":"https:\/\/www.amitbhawani.com\/blog\/category\/web-blogging\/"},"img":{"alt_text":"blogger comments box","src":"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/09\/blogger-comments-box.png?fit=500%2C415&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":23701,"url":"https:\/\/www.amitbhawani.com\/blog\/stop-spam-captcha-contact-forms-comments-earn-money\/","url_meta":{"origin":14016,"position":2},"title":"Stop SPAM with Captcha on Contact Forms &#038; Comments &#038; Earn Money","author":"Amit Bhawani","date":"November 9, 2011","format":false,"excerpt":"Here is an interesting service which i am going to suggest everyone who runs a website, blog or a community forum. This is applicable to all the services where in you get feedback from your readers through a form and using which Spammers also send you SPAM. This service is\u2026","rel":"","context":"In &quot;Make Money Online&quot;","block_context":{"text":"Make Money Online","link":"https:\/\/www.amitbhawani.com\/blog\/category\/make-money-online\/"},"img":{"alt_text":"Captcha Type In","src":"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2011\/11\/Captcha-Type-In.png?fit=648%2C220&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2011\/11\/Captcha-Type-In.png?fit=648%2C220&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2011\/11\/Captcha-Type-In.png?fit=648%2C220&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":2241,"url":"https:\/\/www.amitbhawani.com\/blog\/export-import-blog-posts\/","url_meta":{"origin":14016,"position":3},"title":"How to Export\/Import Blog Posts while Transfer","author":"Amit Bhawani","date":"November 26, 2008","format":false,"excerpt":"If you are transferring your old blog to a new URL or else reinstalling your whole blog because of some updates or broken scripts then its very important to take a complete backup of all your blog posts, user comments and other blog information which was mostly created by you.\u2026","rel":"","context":"In &quot;Wordpress Guide&quot;","block_context":{"text":"Wordpress Guide","link":"https:\/\/www.amitbhawani.com\/blog\/category\/wordpress\/"},"img":{"alt_text":"Import Wordpress Blog Posts","src":"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/Images\/I\/Import-Blog-Posts.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":20190,"url":"https:\/\/www.amitbhawani.com\/blog\/highlight-selected-content-blogs-wordpress-plugin\/","url_meta":{"origin":14016,"position":4},"title":"Highlight visitor selected Content on blogs with WP Plugin","author":"Yogesh Patel","date":"December 17, 2010","format":false,"excerpt":"Any text or important sentence has to be standout in the content or article that you have provided. The standout text should be always the first attention of the users and this should make users more attracted towards your article so that they readout whole of your article, maybe they\u2026","rel":"","context":"In &quot;Wordpress Guide&quot;","block_context":{"text":"Wordpress Guide","link":"https:\/\/www.amitbhawani.com\/blog\/category\/wordpress\/"},"img":{"alt_text":"Highlighter Live","src":"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/12\/Highlighter-live.png?fit=635%2C423&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/12\/Highlighter-live.png?fit=635%2C423&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.amitbhawani.com\/blog\/wp-content\/uploads\/2010\/12\/Highlighter-live.png?fit=635%2C423&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":360,"url":"https:\/\/www.amitbhawani.com\/blog\/introducing-the-the-world-wide-web-blog\/","url_meta":{"origin":14016,"position":5},"title":"Introducing the The World Wide Web Blog","author":"Amit Bhawani","date":"February 23, 2008","format":false,"excerpt":"Well guys its time for you to move on and start reading another web blog which has been recently started and is gaining momentum every passing day. Iam sure you would have got bored reading this blog and thats the reason i thought of showing you guys another blog which\u2026","rel":"","context":"In &quot;Blogging&quot;","block_context":{"text":"Blogging","link":"https:\/\/www.amitbhawani.com\/blog\/category\/web-blogging\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.amitbhawani.com\/blog\/wp-json\/wp\/v2\/posts\/14016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.amitbhawani.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.amitbhawani.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.amitbhawani.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.amitbhawani.com\/blog\/wp-json\/wp\/v2\/comments?post=14016"}],"version-history":[{"count":0,"href":"https:\/\/www.amitbhawani.com\/blog\/wp-json\/wp\/v2\/posts\/14016\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.amitbhawani.com\/blog\/wp-json\/wp\/v2\/media\/20000"}],"wp:attachment":[{"href":"https:\/\/www.amitbhawani.com\/blog\/wp-json\/wp\/v2\/media?parent=14016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.amitbhawani.com\/blog\/wp-json\/wp\/v2\/categories?post=14016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.amitbhawani.com\/blog\/wp-json\/wp\/v2\/tags?post=14016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}