Skip to main content
Your code was missing '>' next to "'guid ="
Source Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459

Why would you need that? ID in a database is auto increment - it manages it's value itself. If your target is to set custom guid, you should update the inserted post as soon as it is created via wp_update_post right after your $post_id = wp_inserted_post($mypost); like this:

...Your code above...
$postid = wp_insert_post($mypost);
$data = array(
   'ID' => $postid,
   'guid' => get_option('siteurl') .'/?post_type=ai1ec_event&p='.$postid.'&instance_id=' //You were missing a '>' next to "'guid'"
);
wp_update_post( $data );

Why would you need that? ID in a database is auto increment - it manages it's value itself. If your target is to set custom guid, you should update the inserted post as soon as it is created via wp_update_post right after your $post_id = wp_inserted_post($mypost); like this:

...Your code above...
$postid = wp_insert_post($mypost);
$data = array(
   'ID' => $postid,
   'guid' => get_option('siteurl') .'/?post_type=ai1ec_event&p='.$postid.'&instance_id=' //You were missing a '>' next to "'guid'"
);
wp_update_post( $data );

Why would you need that? ID in a database is auto increment - it manages it's value itself. If your target is to set custom guid, you should update the inserted post as soon as it is created via wp_update_post right after your $post_id = wp_inserted_post($mypost); like this:

...Your code above...
$postid = wp_insert_post($mypost);
$data = array(
   'ID' => $postid,
   'guid' => get_option('siteurl') .'/?post_type=ai1ec_event&p='.$postid.'&instance_id='
);
wp_update_post( $data );

Why would you need that? ID in a database is auto increment - it manages it's value itself. If your target is to set custom guid, you should update the inserted post as soon as it is created via wp_update_post right after your $post_id = wp_inserted_post($mypost); like this:

...Your code above...
$postid = wp_insert_post($mypost);
$data = array(
   'ID' => $postid,
   'guid' ==> get_option('siteurl') .'/?post_type=ai1ec_event&p='.$postid.'&instance_id=' //You were missing a '>' next to "'guid'"
);
wp_update_post( $data );

Why would you need that? ID in a database is auto increment - it manages it's value itself. If your target is to set custom guid, you should update the inserted post as soon as it is created via wp_update_post right after your $post_id = wp_inserted_post($mypost); like this:

...Your code above...
$postid = wp_insert_post($mypost);
$data = array(
   'ID' => $postid,
   'guid' = get_option('siteurl') .'/?post_type=ai1ec_event&p='.$postid.'&instance_id='
);
wp_update_post( $data );

Why would you need that? ID in a database is auto increment - it manages it's value itself. If your target is to set custom guid, you should update the inserted post as soon as it is created via wp_update_post right after your $post_id = wp_inserted_post($mypost); like this:

...Your code above...
$postid = wp_insert_post($mypost);
$data = array(
   'ID' => $postid,
   'guid' => get_option('siteurl') .'/?post_type=ai1ec_event&p='.$postid.'&instance_id=' //You were missing a '>' next to "'guid'"
);
wp_update_post( $data );
Source Link
david.binda
  • 3.4k
  • 1
  • 20
  • 16

Why would you need that? ID in a database is auto increment - it manages it's value itself. If your target is to set custom guid, you should update the inserted post as soon as it is created via wp_update_post right after your $post_id = wp_inserted_post($mypost); like this:

...Your code above...
$postid = wp_insert_post($mypost);
$data = array(
   'ID' => $postid,
   'guid' = get_option('siteurl') .'/?post_type=ai1ec_event&p='.$postid.'&instance_id='
);
wp_update_post( $data );