【发布时间】:2017-09-06 18:07:44
【问题描述】:
程序已经编程后通过函数添加帖子
wp_insert_post()
无法在 acf 插件中获取数据和字段。 数据在帖子中的字段中可用,但在客户端不可用。 只有单击管理部分内的“更新”按钮后才能获得输出。之后,输出数据 填帖如下:
$post_data = array(
'post_title' => wp_strip_all_tags($item->name),
'post_content' => "",
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_category' => array(3,13,2)
);
$post_id = wp_insert_post( $post_data );
update_field( "link_to_1", $item->image, $post_id );
update_field( "link_to_2", $item->tour, $post_id );
客户端的结论如下:
<img src="<?php the_field('link_to_1');?>"/>
【问题讨论】:
-
您的元键名错误
-
抱歉,我在这段代码中更改了元键。所有元键都是真的。不工作
-
你如何得到 $item->image 我的意思是循环在哪里或者有 $item 变量的东西
标签: wordpress wordpress-theming