Wordpress sitemin botu eskiden normal çalışıyordu. Sonra sunucu çökünce yenisini ubuntu 16.xx kurunca php7 kurulmuş dikkat etmemişim. Botum çalışmadı. Akabinde mysqli olarak bir iki şey düzenleyince çalıştı ama bu sefer de aynı yazıyı birkaç kere eklemeye başladı. Eskiden güncellendi oluyordu eklemiyordu. Bana yardım edebilecek var mı acaba?
// 1. Create a database connection
$connection = mysqli_connect("localhost","xxxxxxxxxxxxxxx","xxxxxxxxxxxxxxx");
if (!$connection) {
die("Database connection failed: " . mysqli_error());
}
// 2. Select a database to use
$db_select = mysqli_select_db($connection, "xxxxxxxxxxxxxxx");
if (!$db_select) {
die("Database selection failed: " . mysqli_error());
}
$query = "select ID from xxx_posts WHERE post_excerpt='$basligim'";
$sonuc = @mysqli_query($query,$connection);
if(@mysqli_num_rows($sonuc)==0){
$insert_post = array();
$insert_post['post_title'] = $basligim;
$insert_post['post_content'] = $aciklama;
$insert_post['tags_input'] = $tetiket;
$insert_post['post_status'] = 'publish';
$insert_post['post_author'] = 1;
$insert_post['post_category'] = array(1584);
$pid = wp_insert_post($insert_post);
mysqli_query("UPDATE xxx_posts SET post_content='$aciklama' WHERE ID='$pid'");
$tarih=date("Y-m-d H:i:s");
mysqli_query("UPDATE xxx_posts SET post_modified='$tarih' WHERE ID='$pid'");
add_post_meta($pid, 'imagelink', $imagelinkana);
add_post_meta($pid, 'gorbaslik', $gorbaslik);
echo '<center>'.$basligim.' <b>Eklendi.</b></center>';
}else{
$query = mysqli_query("SELECT from xxx_posts WHERE post_excerpt='$basligim'");
$pid = $result2[0];
mysqli_query("UPDATE xxx_posts SET post_content='$aciklama' WHERE ID='$pid'");
mysqli_query("SELECT * FROM xxx_posts WHERE post_excerpt = '$basligim'");
update_post_meta($pid, 'imagelink', $imagelinkana);
update_post_meta($pid, 'gorbaslik', $gorbaslik);
echo '<center>'.$basligim.' <b>Guncellendi.</b></center>';}
$aciklama = '';
flush();
ob_get_contents();
ob_flush();
}
?>