WordPress veritabanına karşı bir PHP komut dosyası çalıştırmak çalışırken ben bu hatayı alıyorum:
Fatal error: Cannot redeclare class wpdb
Herkes bana bu giderilmesine yardımcı olabilir?
Edit
Kod:
require_once(dirname(__FILE__) . '/../../wp-config.php');
require_once(dirname(__FILE__) . '/../../wp-includes/wp-db.php');
$wpdb->show_errors();
$dupes = $wpdb->get_results('select bad_rows.* from wp_posts as bad_rows inner join ( select post_title, MIN(id) as min_id from wp_posts group by post_title having count(*) > 1 ) as good_rows on good_rows.post_title = bad_rows.post_title and good_rows.min_id <> bad_rows.id; ');
foreach ($dupes as $dupe)
{
echo $dupe->post_title ."\n";
}
$wpdb->query(' delete bad_rows.* from wp_posts as bad_rows inner join ( select post_title, MIN(id) as min_id from wp_posts group by post_title having count(*) > 1 ) as good_rows on good_rows.post_title = bad_rows.post_title and good_rows.min_id <> bad_rows.id; ');