2017-08-27 106 views
1

我正在做一個IONIC應用程序,該項目需要通過Wordpress API與自定義字段(我正在使用ACF Pro和Aires ACF到REST API)創建帖子,我可以創建一個帶有REST API的普通帖子,即使是,ACF字段也不會創建或放棄,只有當我在Wordpress管理界面中創建帖子時,纔會爲帖子創建ACF字段。通過WP Rest API創建自定義字段的帖子

我正在閱讀ACF到REST API的文檔,但我只看到編輯和顯示功能。這是否意味着後期元必須存在?因此,如何提前爲後 「創造」 他們

感謝您的幫助

問候

phpadmin後創建:

phpadmin post creating

缺席後薈萃:

absence of post meta

回答

0
$json = file_get_contents('PATH/TO/FILE.json'); 
function the_json_contents($json_to_get){ 

      $json_in_array = json_decode($json_to_get, true); //json string to array 

      return $json_in_array; 
     } 
function do_stuff_do_json() { 
    $json_array = the_json_contents($json); 
    foreach($json_array['id'] as $js) { //assuming we have an 'id' key 
     $somevariable = $js['someKey']; 
     $somevariable2 = $js['someOtherKey']; 
    } 

} 

請參閱this solution

相關問題