0

我想使用 WP-Crontrol 自动删除具有特定内容的 Wordpress 帖子(或者可能是我还不知道的更好的解决方案)。我添加了以下 cron 作业,但它没有做任何事情:

global $wpdb;
$result = $wpdb->get_results( "SELECT ID FROM wp_posts WHERE post_content LIKE 'Content which should result in a deletion of this post'" );
  if ($result){
    foreach($result as $pageThing){
      wp_delete_post($pageThing);
    }
  }

我怎样才能让它工作?谢谢

http://wordpress.org/extend/plugins/wp-crontrol/

4

1 回答 1

0

您需要require_once('absolute-path/wp-load.php')在 cron 脚本的顶部然后运行您的脚本。您现在拥有的应该可以工作。

于 2013-03-12T10:03:34.093 回答