As Codex says about wp_update_post
:
To work as expected, it is necessary to pass the ID of the post to be updated.
Filling out the ID field is not strictly necessary but without it there is little point to using the function.
So you must add newly created post ID to $posts
to update it.
function wp_emallmobnok(){
$postdater = parsidate('j / F / Y',$datetime="now",$lang='pre');
$postdate = date('Y-m-d H:i:s');
$ta = parsidate('j / F / Y',$datetime="now",$lang='pre');
$postdate_gmt = date('Y-m-d H:i:s');
$titles ="price daily";
// Post data
$posts = array(
'post_content' => $oiobz1,
'post_name' => $titles,
'post_title' => $titles,
'post_type' => 'post',
'post_status' => 'publish',
'post_author' => '6',
'ping_status' => 'open',
'post_date' => $postdate_gmt,
'post_category' => array(188),
'tags_input' => " price",
);
$post_id = wp_insert_post($posts);//// instert post
add_post_meta( $post_id, ' wp_insert_post', 0, true );
// Update post if inserting was successful
if( $post_id !== 0 && !is_wp_error( $post_id ) ){
// Add post ID to post data
$posts['ID'] = intval( $post_id ); // ID has to be integer
$post_up = wp_update_post($posts);///update post
add_post_meta( $post_id, ' wp_update_post', 0, true );
}
else if( is_wp_error( $post_id ) ){
$error_string = $post_id->get_error_message();
echo 'ERROR: '.$error_string;
}
}