I am using the Wordpress theme WPJobus and I had the necessity to modify the workflow of Resume Submission and Resume Editing.
The functions which provide for these operations are located as usual into the file /mytheme/functions.php
wpjobusSubmitResumeForm()
wpjobusEditResumeForm()
On both of them I have removed the whole code portion which switch post status to "Draft" on every edit occurrence, since I needed to give to the new user the possibility to insert their own posts (Resumes) and publish without the Administrator supervision.
Anyway, I made the all changes and everything works fine except the function wp_update_post() with posts.post_title field!
The code looks like this:
$post_information = array(
'ID' => $td_current_post,
'post_title' => $_POST['fullName'],
'post_content' => strip_tags($_POST['postContent']),
'post_type' => 'resume',
'post_name' => $td_current_post,
'comment_status' => 'closed',
'ping_status' => 'closed',
'post_status' => 'publish'
);
$td_post_id = wp_insert_post($post_information);
wp_update_post(
array(
'ID' => $td_post_id,
'post_name' => $td_post_id
)
);
The INSERT works fine but when I call the UPDATE, which is absolutely necessary for post_name field, post_name is correctly updated while post_title value is deleted.
I got the same effect even if I try to pass 'post_title'=>$_POST['fullName'] within wp_post_update array.
Anyone had the same issue?
I also found this but it didn't help at all: wp_update_post inserts empty title and content
post_nameto be the ID in the update? - doublesharp