【发布时间】:2014-11-12 00:40:57
【问题描述】:
我正在使用带有中继器的 acf。 我正在尝试通过 update_field 向转发器添加一行,但是,当我打开一个帖子以确认它是否在 wordpress 的管理员中工作时,它一直在加载并给我这个错误:
Fatal error: Maximum execution time of 30 seconds exceeded.
当我回显 $value 时,我得到:“bool(false)”,这是我的代码:
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();
}
}
【问题讨论】:
标签: php wordpress repeater advanced-custom-fields