wp_update_post does not update post_name

I have a post with id=1, post_title="Some post title" and slug(post_name)='some-post-title.

I want to update its title and slug.

$update_args = array(
    'ID' => '1',
    'post_title' => 'Test purpose',
    'post_name' => 'new-slug'
);
$result = wp_update_post($update_args);

After that post title is updated but slug stays the same(some-post-title) but not new-slug.

I cannot understand how can i update post-slug.

0

Leave a Comment