I have a custom field in the PRODOTTI post type
$meta_boxes[] = array(
'title' => esc_html__( 'Link Stripe', 'scadenza' ),
'post_types' => array('prodotti'), // <- post-type PRODOTTI
'fields' => array(
array(
'name' => 'Link Stripe',
'id' => 'stripeUrl',
'type' => 'text',
),
)
);
In a single post of the DOMINI post type I recall a post from PRODOTTI with type=>post
$meta_boxes[] = array(
'title' => esc_html__( 'Prodotto', 'scadenza' ),
'post_types' => array('domini'), // <- post-type DOMINI
'fields' => array(
array(
'name' => 'Prodotto singolo',
'id' => 'prodotto_singolo',
'type' => 'post', // <- type POST
// Post type.
'post_type' => 'prodotti',
// Field type.
'field_type' => 'select_advanced',
),
)
);
I want to display the value of the 'stripeUrl' field and use this code
$prodotto = rwmb_meta( 'prodotto_singolo', $post_id );
if ( $prodotto ) {
$stripeUrl = rwmb_meta( 'stripeUrl', $prodotto );
}
First I load the ID of the 'prodotto_singolo' field and then I want to load the 'stripeUrl' value using $prodotto like $post_id, but no value is displayed.
Where am I wrong?