so James in order to achieve your goal you need to remove the meta-box and re-add it with the new callback that contain the new value;
so lets assume originally you have the meta-box added as below :
function adifier_custom_meta()
{
$screens = ['page', 'post'];
foreach ($screens as $screen) {
add_meta_box(
'advert_cond', // Unique ID
esc_html__('Condition', 'adifier'), // Box title
'adifier_get_advert_meta', // Content callback, must be of type callable
$screen, // Post type,
'side'
);
}
}
add_action('add_meta_boxes', 'adifier_custom_meta');
and the original call-back output as following :
function adifier_get_advert_meta($post)
{
$value = get_post_meta($post->ID, '_advert_cond_meta_key', true);
?>
<label for="advert_cond">Description for this field</label>
<select name="advert_cond" id="advert_cond" class="postbox">
<option value="0"><?php echo esc_html__('-Select-', 'adifier') ?></option>
<option value="1" <?php selected($value, '1');?>><?php echo esc_html__('New with tags', 'adifier') ?></option>
<option value="1" <?php selected($value, '2');?>><?php echo esc_html__('New with tags', 'adifier') ?></option>
<option value="3" <?php selected($value, '3');?>><?php echo esc_html__('Used with tags', 'adifier') ?></option>
<option value="4" <?php selected($value, '4');?>><?php echo esc_html__('For Parts Or Not Working', 'adifier') ?></option>
</select>
<?php
}
in order to change above we need to add the following functions:
add_action('add_meta_boxes', 'adifier_custom_meta2');
function adifier_custom_meta2()
{
$screens = ['page', 'post'];
remove_meta_box('advert_cond', $screens, 'side');
add_meta_box(
'advert_cond', // Unique ID
esc_html__('Condition', 'adifier'), // Box title
'adifier_get_advert_meta2', // Content callback, must be of type callable
$screens, // Post type,
'side'
);
}
and now we will add our new call-back output with our new values :
function adifier_get_advert_meta2($post)
{
$value = get_post_meta($post->ID, '_advert_cond_meta_key', true);
?>
<label for="advert_cond">Description for this field</label>
<select name="advert_cond" id="advert_cond" class="postbox">
<option value="0"><?php echo esc_html__('-Select-', 'adifier') ?></option>
<option value="1" <?php selected($value, '1');?>><?php echo esc_html__('New', 'adifier') ?></option>
<option value="2" <?php selected($value, '3');?>><?php echo esc_html__('Used', 'adifier') ?></option>
<option value="3" <?php selected($value, '4');?>><?php echo esc_html__('For Parts Or Not Working', 'adifier') ?></option>
</select>
<?php
}
for more information you can check WordPress Doc from the following links: