WordPress - update_post_meta 不适用于某个领域

WordPress - update_post_meta not working for a field

我试图在每个 post 的基础上保存一些简单的元数据,但发现 update_post_meta 似乎并没有真正保存一个字段的元数据。 输入字段是:

<input size="30" type="text" class="rwmb-text" id="themeum_movie_info_type" name="themeum_movie_info[0][themeum_movie_info_type]">

我正在尝试使用此代码保存元数据:

update_post_meta( $get_post_id, 'themeum_movie_info[0][themeum_movie_info_type]', 'Country:' );

我找到了解决办法。我们必须创建一个数组,然后将数组放入 update_post_meta 函数中,如下所示:

$array = array(
        '0' => array(
            'themeum_movie_info_type' => 'Country'
        )
);
update_post_meta( $get_post_id, 'themeum_movie_info', $array );