With the data entered on the option page, I want to automatically insert a new message (wp_insert_post) with this data. To do this, the customer must select a Radio Button (yes/no). I am trying to read that RadioButton but it does not succeed.
Someone who has counsel?
(The Radiobutton ID: ‘new’ and the fieldname: ‘new_message’)
function make_weatherpost($post_id) {
//if( empty($_POST[‘acf’]) ) {
// return;
//}
// Check the values sent.
echo ‘Show the data: ‘ . $_POST[‘acf’][‘new’];
$values = $_POST[‘acf’][‘new’];
echo $values[‘value’] . ‘ – ‘ . $values[‘label’] . ‘ – ‘ . $values;
if ($values == ‘Ja’) {
echo “TRUE ” . $values[‘value’] . $values[‘label’] . $values;
} else {
echo “FALSE ” . $values[‘value’] . $values[‘label’] . $values;
}
}
add_action(‘acf/save_post’, ‘make_weatherpost’, 5);
Solved it an other way 😉
I inserted the data from the options page as a new post.