自定义字段,又名。自定义post元字段存储在wp\\U POSTETA表中。
使用此代码更新元,而不是遍历表。修改条件以针对某个帖子或某个元值:
$args = array(\'post_type\' => \'product\');
$query = new WP_Query( $args );
foreach($query->posts as $post) {
$meta = get_post_meta($post->ID, \'price\', true);
if ($post->ID == \'85\' && $meta == \'$\') { // Set search condition here
update_post_meta($post->ID, \'price\', \'100\'); //change meta value here
}
}