I have two fields in wp_posts table that wp_update_post()
seems to be unable to change. I’m trying to use the following code:
$echo $group_access;
$echo $tag_list;
$my_post = array(
'ID' => 12095,
'post_title' => 'Test Title',
'post_content' => 'Test Content',
'group_access' => $group_access,
'tag_list' => $tag_list,
);
// Update the post into the database
$post_id = wp_update_post( $my_post, true );
if (is_wp_error($post_id)) {
$errors = $post_id->get_error_messages();
foreach ($errors as $error) {
echo $error;
}
}
The $group_access
and $tag_list
variables echo the correct values. The post_title
and post_content
update correctly. group_access
and tag_list
do not update, and there is no error either.
Naturally, I’ve checked the table and group_access
and tag_list
are the correct column headers.
I’m baffled why it doesn’t work. Is wp_update_post()
unable to change columns that are not part of the default WP install? Is it possibly a datatype thing (e.g. I should be passing an array or integer, but I’m passing a string)?