Thread Starter
rajrin
(@rajrin)
OK _ Problem solved
Instead of separately updating the category I am using the wp_update_post function…and it works.
require ‘wp-blog-header.php’;
$post_author = $_POST[‘post_author’];
$cats = array();
$x = $_POST[‘cat’];
if ($x){
foreach ($x as $t){
//echo $t;
array_push($cats,$t);
}
}
$post_category = $cats;
$post_datar = compact(‘ID’, ‘post_author’, ‘post_date’, ‘post_date_gmt’, ‘post_content’, ‘post_title’, ‘post_category’, ‘post_status’, ‘post_excerpt’, ‘post_name’);
wp_update_post($post_datar);