需要 MySQL 查询来删除 WordPress 评论

发布于 2025-01-04 21:55:55 字数 214 浏览 4 评论 0原文

我的 WordPress 网站最近被黑客攻击,所以我不得不重新安装所有内容。重新安装了 WordPress,导入了数据库备份,一切都很好。然后我安装了 Disqus 插件并同步(Disqus 之前在网站被黑客攻击之前使用过)。显然是大禁忌。现在我网站上的每条评论都有副本!更糟糕的是,重复的评论已同步回 Disqus!

所以,我知道这是 PHPMyAdmin 中的一个简单查询,但我不知道!请帮忙!

My wordpress site was recently hacked so I had to reinstall everything. Wordpress resinstalled, database backups imported, everything fine and dandy. Then I installed the Disqus plugin and synced (Disqus was previously used before the site was hacked). Big no-no apparantly. Now I have a duplicate of every single comment on my site! Even worse, the duplicate comments have been synced BACK to Disqus!

So, I know this is a simple query in PHPMyAdmin but I don't know it! Please help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夜空下最亮的亮点 2025-01-11 21:55:55

请记住,有一个一个 WordPress Stack Exchange 网站;)

我会使用 PHP,除非您立即知道 wpdb 名称。一定要先备份数据库!就像这样:

global $wpdb;

$comments = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."_comments"
   ." ORDER BY comment_post_ID, comment_content");

$prev = NULL;

foreach($comments as $comment) {

  if ($prev && $prev->comment_content == $comment->comment_content
    && $prev->comment_post_ID == $comment->comment_post_ID ) { // add maybe other rules here

    $wpdb->query("DELETE FROM ".$wpdb->prefix."_comments" WHERE comment_ID == $comment- >comment_ID");

  }
  else
    $prev = $comment;
}

Keep in mind that there is a WordPress Stack Exchange website ;)

I would use PHP unless you know the wpdb name off the top of your head. Be sure to back up the DB first! Like so:

global $wpdb;

$comments = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."_comments"
   ." ORDER BY comment_post_ID, comment_content");

$prev = NULL;

foreach($comments as $comment) {

  if ($prev && $prev->comment_content == $comment->comment_content
    && $prev->comment_post_ID == $comment->comment_post_ID ) { // add maybe other rules here

    $wpdb->query("DELETE FROM ".$wpdb->prefix."_comments" WHERE comment_ID == $comment- >comment_ID");

  }
  else
    $prev = $comment;
}
壹場煙雨 2025-01-11 21:55:55

如果他不知道如何使用 mysql,我认为重新编辑 wp 界面很棒,因为通常 wp 会在那里创建查询的构建函数。这可能会再次导致它的毁灭。

它不起作用的唯一原因可能是因为他们使用的插件。!我想是的。!

If he doesn't know how use mysql, I think re editing the wp interface is great, because usually wp creating there build function for queries. And it may lead again to destruction of it.

The only reason why it doesn't work maybe its because of the plug in they use.! I think so.!

猥琐帝 2025-01-11 21:55:55

mysql 中删除的查询是

Delete from (tablename) where (primarykey)

但我认为 wordpress 有其内置的数据库查询用于选择删除和​​更新。

如果你使用 Disqus 插件,这是另一个

如果您已登录 Disqus 帐户,您还可以选择在仪表板上删除评论。这将从您的个人资料中删除它,并从原始页面的评论中删除所有识别信息。评论一旦匿名,就无法再次声明。

The query for deleting in mysql is

Delete from (tablename) where (primarykey)

But I think wordpress has its build in database queries for select delete and update.

Here's another if you use the plugin Disqus

If you're logged into your Disqus account you can also choose to delete a comment at your dashboard. This will remove it from your profile and remove all identifying information from the comment on the original page. Once a comment has been anonymized it cannot be claimed again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文