也就是说,我希望在创建帖子之前检查“guid\\u review”ACF值,以防止其重复。
foreach ($items as $itemKey => $item) {
$myPost = array(
\'post_type\' => \'client_review\',
\'post_title\' =>(string) $item->title, //the object as a string before attempting to manipulate it.
\'post_content\' =>(string) $item->description
);
$inserted_post_id = wp_insert_post( (array) $myPost );
if( $inserted_post_id ){
add_post_meta( (int) $inserted_post_id,\'guid_review\',(string)$item->guid);
add_post_meta($inserted_post_id,\'link_review\',(string)$item->link);
add_post_meta($inserted_post_id,\'author_review\',(string)$item->author);
add_post_meta($inserted_post_id,\'rating_review\',(string)$item->children(\'d3\', true)->rating);
add_post_meta($inserted_post_id,\'certified_review\',(string)$item->children(\'d3\', true)->certified);
add_post_meta($inserted_post_id,\'pub_date_review\',(string)$item->pubDate);
}
}