<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?PHP
@include("wp-load.php");
@include("wp-config.php");
@include("wp-admin/includes/image.php");
?>
<?PHP
$body=$_POST["konu"];
$title=$_POST["baslik"];
$resimlink=$_POST["resimlink"];
$sure=$_POST["sure"];
$kategori=$_POST['kategori'];
$etiket=$_POST['etiket'];
$articleOption = array();
$articleOption['post_title'] = $title;
$articleOption['post_type'] = 'post';
$articleOption['post_content'] = $body; // İçeriği boş olarak gönderdik
$articleOption['post_status'] = 'publish';
$articleOption['post_author'] = 1; //Admin
$articleOption['tags_input'] = "$etiket"; //Admin
$articleOption['post_category'] = array($kategori);
$exists = $wpdb->get_var("SELECT COUNT( * ) FROM $wpdb->posts WHERE post_title = '$title'");
if (empty($exists)){
if ($post_id = wp_insert_post($articleOption))
{
add_post_meta($post_id, "resim", $resimlink);
add_post_meta($post_id,"sure",$sure);
echo '<strong>Eklendi:</strong> ' . $title;
}
else{
echo '<strong>Eklenemedi:</strong> ' . $title;}
}else{
echo '<strong>Zaten eklenmiş:</strong> ' . $title;  }
?>