0

我想将图像导入 pods.io 自定义图像字段。我试过了

$api = pods_api( 'boek' );
$data = array(
    0 => array(
            'post_title' => 'slug',
            'name' => 'test1',
            'isbn13' => '9780000000001',
            'producttype' => 'Paperback',
            'nur' => 200,
            'omslag' => pods_attachment_import( 'http://barcelonainfo.nl/wp-content/uploads/2012/08/Boek_open.jpg' )
    ),
);

// Run the import
$api->import( $data );

omslag 是一个文件/图像/视频字段。图像已导入但未附加到 omslag 字段中的 POD。

4

1 回答 1

1

You need to set 'omslag' to the ID of the attachment. In this case it looks like the image is already attached since its in your uploads folder, so you should find its ID and set that ID as the value for 'omslag'.

In general, when using the pods_attachment_import() it's best to use it and then pass the return value from the function, which is attachment ID to the import array.

于 2014-06-21T01:33:18.987 回答