Support Forum
Support › General › ✅Add Select Values from Other Custom Fields › Reply To: Add Select Values from Other Custom Fields
Hi Pete,
The Meta Box Builder doesn't allow you to use dynamic values from other fields at the moment. You need to create the meta box and field by code.
Here is an example:
add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
$post_id = null;
if ( isset( $_GET['post'] ) ) {
$post_id = intval( $_GET['post'] );
} elseif ( isset( $_POST['post_ID'] ) ) {
$post_id = intval( $_POST['post_ID'] );
}
$options = array(
'w' => get_post_meta( $post_id, 'w', true ),
'ru' => get_post_meta( $post_id, 'ru', true ),
// and so on.
);
$meta_boxes[] = [
'title' => 'Your title',
'fields' => [
[
'type' => 'select',
'id' => 's',
'name' => 'Select',
'options' => $options,
],
],
];
} );