Home Forums Backend Issues (wp-admin) Saving ACF input data in local fields generated by PHP


Saving ACF input data in local fields generated by PHP

  • I have an ACF form in post edit with Range type generated by PHP (local field no DB usage).
    acf range input form

    So, to store input values i’m using custom meta field. At this moment I can’t find an easy way to alter data in DB after post updating. ACF documentatin demonstrates how to get new values after post update.

    add_action('acf/save_post', 'my_acf_save_post');
    function my_acf_save_post( $post_id ) {
        $values = $_POST['acf'];
        // Check if a specific value was updated.
        if($values && isset($_POST['acf']['...'])) {
            update_post_meta($post_id, 'test_field', $_POST['acf']['...']);

    $_POST[‘acf’] data looks like this:
    acf post data

    The only way to get field value is to specify the key ID of the field.
    The main problem is that initial field key doesn’t match with $_POST[‘acf’] key!

    Initial key Id obtained with acf function:

    acf field structure

Viewing 1 post (of 1 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.