I create a select function that I created earlier.
<?php
$groups = rwmb_meta('group_pictag');
foreach ( $groups as $group ) {
// Field tw_tag:
echo $group[ 'tw_tag' ] ?? '';
// Field en_tw:
echo $group[ 'en_tw' ] ?? '';
}
?>
Function syntax
function getGroupDetails() {
$groups = rwmb_meta('group_pictag');
$result = [];
foreach ($groups as $group) {
// Add tw_tag and en_tw to the result array
$result[] = [
$group['en_tw'] => $group['tw_tag'], // Ensure the key name is valid
];
}
return $result;
}
Write the selector
callback: getGroupDetails
And call the custom sanitize callback
Fill in getGroupDetails
What's wrong?