weStarz adlı üyeden alıntı: mesajı görüntüle
Kodlar alttaki gibi çok teşekkür ederim

<meta charset="utf-8" />
<?php
error_reporting(0);	
include ("ayar.php");

$site = $_SERVER['HTTP_HOST'];
$site= str_replace('http://','',$site);
$site= str_replace('www.','',$site);
$site = trim($site);	

$sql1 = "SELECT * FROM haberler ORDER BY id ASC LIMIT 0,1";
$result1 = mysql_query($sql1);
while ($veri1 = mysql_fetch_array($result1))  { 
$cekilecek = $veri1["id"];
$baslik = $veri1["baslik"];
$kategorisi = $veri1["kategori"];
$icerik = $veri1["icerik"];
$resim = $veri1["resim"];
$etiketler = $veri1["etiketler"];

$exists = mysql_query("SELECT * FROM islemler WHERE haber_id = '$cekilecek' and site= '$site'");
$kontrolyap = mysql_num_rows($exists);	
if ($kontrolyap == 0) {

include ("../wp-load.php");
include ("../wp-admin/includes/taxonomy.php");	

$categories=get_categories(); 
foreach($categories as $category) { 
$dizi =  "$category->cat_name";
$id =  "$category->term_id";
}
$yeni_dizi = strtolower($dizi);	

if (preg_match("#$kategorisi\b#", $yeni_dizi)) {	

$wordpress_kayit = array(
'post_title' => $baslik,
'post_content' => $icerik,
'post_category' => array($id),
'post_status' => 'publish',
//post type için farklı post type türleri kullanabilirsiniz post/page/attachment/galeri
'tags_input' => $etiketler,
'post_type' => 'post',
);	

$post_id = wp_insert_post($wordpress_kayit ,FALSE);		
}else {
$id = wp_create_category($kategorisi, 0);	
$wordpress_kayit = array(
'post_title' => $baslik,
'post_content' => $icerik,
'post_category' => array($id),
'post_status' => 'publish',
//post type için farklı post type türleri kullanabilirsiniz post/page/attachment/galeri
'tags_input' => $etiketler,
'post_type' => 'post',
);	

$post_id = wp_insert_post($wordpress_kayit ,FALSE);		
}
$image_url = $resim;

$upload_dir = wp_upload_dir();
$image_data = file_get_contents($image_url);
$filename = basename($image_url);
if(wp_mkdir_p($upload_dir['path']))
$file = $upload_dir['path'] . '/' . $filename;
else
$file = $upload_dir['basedir'] . '/' . $filename;
file_put_contents($file, $image_data);

$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_title' => sanitize_file_name($filename),
'post_content' => '',
'post_status' => 'inherit'
);

$attach_id = wp_insert_attachment( $attachment, $file, $post_id );
require_once(ABSPATH . 'wp-admin/includes/image.php');
$attach_data = wp_generate_attachment_metadata( $attach_id, $file );
wp_update_attachment_metadata( $attach_id, $attach_data );

set_post_thumbnail( $post_id, $attach_id );

mysql_query("INSERT INTO islemler SET
site = '$site',
haber_id = '$cekilecek'
") or die (mysql_Error());		

}		

}	



?>
Hocam tam olarak hangi alanda yapmak istediğiniz işlemi yapıyorsunuz
if ($kontrolyap == 0) {
bu kodun else kısmında mı