Tell us what you are trying to do?
I am trying to insert a new post manually using code into my custom type post call quote. I have created the relevant post fields. here is my code:
global $wpdb;
$todayquote = date("F j, Y, g:i a");
$my_post = array(
'post_title' => $mydisplayname,
'post_content' => 'Quotes.',
'post_status' => 'publish',
'comment-status' => 'closed',
'ping-status' => 'closed',
'post_author' => 1,
'post-type' => 'quote',
);
$new_post_id = wp_insert_post( $my_post, $wp_error=true );
update_post_meta($new_post_id,'wpcf-eventdates' , $eventDate);
update_post_meta($new_post_id,$new_post_id,'wpcf-nailtechnician', $name);
update_post_meta($new_post_id,'wpcf-wpcf-wigs',$Wigs);
update_post_meta($new_post_id,'wpcf-weaveandextension' ,$WeaveandExtension);
update_post_meta($new_post_id,'wpcf-postcodequote', $postcode);
update_post_meta($new_post_id,'wpcf-starttime', $startAndfinishS);
update_post_meta($new_post_id,'wpcf-finishtime', $startAndfinishF);
update_post_meta($new_post_id,'wpcf-lashestechnician' , $Lashestechnician);
update_post_meta($new_post_id,'wpcf-professionalmakeup', $ProfessionalMakeup);
update_post_meta($new_post_id,'wpcf-braidingandplating', $BraidingandPlating);
update_post_meta($new_post_id,'wpcf-timeavailability' , $timeavailability);
update_post_meta($new_post_id,'wpcf-homevisit' , $homevisit);
if(!is_wp_error($new_post_id)){
echo ' Inserted into database';
}else{
echo $ids->get_error_message();
}
I don't get error and it says the data has been inserted but when i check in the back end I don't see the new post.
Steps
1. go to my site hidden link
2. Add expert to the shortlist
3. Hover on the shortlist icon on the top right of the site which will have 1 item added
4. Click on view my shortlist which take you to the shortlist page
5. Fill in the form and click submit.
Is there any documentation that you are following?
Is there a similar example that we can see?
What is the link to your site?