Support

Account

Home Forums Add-ons Repeater Field Adding rows to a ACF's Repeater through update_field working unappropiately

Unread

Adding rows to a ACF's Repeater through update_field working unappropiately

  • I’m using acf with reapeters. I’m trying to add a row to a repeater through update_field, however, when I open a post to confirm if it works in wordpress’ admin, it kept loading and gave me this error:

    Fatal error: Maximum execution time of 30 seconds exceeded.
    When I echo $value, I get this: “bool(false)”, here’s my code:

    foreach($dishes as $current_dish)
    {
        $local_category_id = strval($current_dish['id_CategoriaTicket']);
    
        if($local_category_id == $categoryId)
        {
            $prueba = $current_category->post_title;
    
            $new_dish = array(
                'post_title' => $current_dish['Descripcion'],
                'post_status'   => 'publish',
                //'post_content' =>'',
                'post_type' => 'products'
                //'post_author' => $user->ID
            );
    
            $post_id = wp_insert_post( $new_dish );
    
            global $cpt_onomy;
            $cpt_onomy->wp_set_post_terms( $post_id , $prueba, 'categories');
    
            update_post_meta($post_id, 'product_type', "Platillo");
    
            $field_key = 'product1';
    
            $value = get_field($field_key, $post_id);
    
            $value[] = array("price_id" => "2",
                "price" => "30",
                "location" => 2
                );
    
            update_field($field_key, $value, $post_id );
            exit();
        }
    }
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.