How Do I Move Posts on WordPress Blog?

If you want to move a post from one blog post to another on your WordPress blog, you can use the WP_Move_Post function. This function will copy the post from one location on the blog to another, and it will also automatically update any associated comments. The following code example shows how to use the WP_Move_Post function to move a post from the posts page to the archive page:

// Move a post from the posts page to the archive page. $post = get_post(); // Use the WP_Move_Post function to copy the post to its new location. wp_move_post($post, ‘archive’);

If you want to move a post without updating any comments, you can use the WP_Move_Post function with no arguments. This will simply copy the post without any changes.

Related Posts