Home Forums Add-ons Options Page Can't read option-field before saving


Can't read option-field before saving

  • 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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.