Support

Account

Forum Replies Created

  • Having the same issue as @perrydc

    We are using the documentation recommended change and hard-coding our api key but getting the NoApiKeys error in the console.

    This has been added to my theme’s functions.php file

    /** Google Map API Key for place lookup */
    function my_acf_google_map_api( $api ){
            $api['key'] = 'zzzzzz'; /* my key is here */
            return $api;
    }
    add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
  • I switched to the ‘acf/save_post’ hook instead of ‘transition_post_status’, per a support ticket, and it’s saving now 🙂

    I got the post id by echoing out get_the_ID() (see code comments); I just hardcoded it to be sure. This was just a basic text field. To test, I was just saving the post and checking to see that the field had been updated from the edit-post view.

    Note: For this to work, I set the priority to 20; leaving it as 1 (before post save) didn’t work.

    Thanks for the help.

  • @hube2 Thanks for responding 🙂

    I added the following:

    
    $field = get_field_object('notification_record');
    var_dump($field["key"]);
    exit;
    

    which gave me ‘field_57cee83c43f92’ as the key

    so I updated my code here and it’s still not saving 🙁

    
    function do_something_on_save( $new_status, $old_status, $post ) {
        
        //echo get_the_ID(); //returns 13
        //exit;
    
        //$field = get_field_object('notification_record');
        //var_dump($field["key"]); //returns 'field_57cee83c43f92'
        //exit;
    
        update_field(
            'field_57cee83c43f92',
            'checking',
            13
        );
    }
    add_action( 'transition_post_status', 'do_something_on_save', 10, 3 );
    
Viewing 3 posts - 1 through 3 (of 3 total)