Updating post_parent by id (many times)
How can I update post_parent
by ids?
I tried:
add_action('init','updating_parent');
function updating_parent(){
$args = array(
'post__in' = array(208,51)
);
$my_posts = get_posts( $args );
foreach ( $my_posts as $my_post ):
$my_post['post_parent'] = 12;
wp_update_post( $my_post );
endforeach;
}
But this is not working. But even it wouldn't be what I need. Since I have data like:
ID = post_parent
208 = 12
51 = 19
and so on...
So I need an array at post_parent
as well.
Topic wp-update-post Wordpress
Category Web