Why does wp_update_post causes white screen?
I made a custom post type, named Foglalás. Each post in the Foglalás post type has neither title nor permalink. All of them are kind of Auto Draft after saving. So, I would like to get the post ID and set it to be the title and permalink as well. I use the following code:
function foglalasi_adatok( $post_id ) {
$post = array(
'ID' = $post_id,
'post_title' = $post_id,
'post_name' = $post_id,
);
wp_update_post( $post );
update_post_meta($post_id, 'foglalas_szama', $post_id);
}
add_action('save_post_foglalas', 'foglalasi_adatok');
When adding new post in this type, Wordpress throw a blank page. When commenting out wp_update_post( $post ), the update_post_meta is working fine.
What do I do wrong?
EDIT: I checked and no plugin conflicts.
Topic wp-update-post custom-post-types Wordpress
Category Web