当我从分类学中获得图像字段时,它就可以正常工作
但中继器字段数据显示null
// /wp-json/wp/v2/taxonomy-reviews/taxonomyName
function taxonomyReviews($taxonomyName) {
$terms = get_terms([
'taxonomy' => $taxonomyName['name'],
'hide_empty' => false,
]);
$reviews = [];
foreach ($terms as $term) {
$reviews[]=[
'name' => $term->name,
'slug' => $term->slug,
'image' => get_field('image', $taxonomyName['name'] . '_' . $term->term_id),
'reviews' => get_field('weds_reviews', $taxonomyName['name'] . '_' . $term->term_id),
];
}
return $reviews;
}
[
{
"name": "Bridal Designers",
"slug": "bridal-designers",
"image": "http://wedsphotography.local/wp-content/uploads/2020/04/Rectangle-952-7.png",
"reviews": null
},
{
"name": "Bridal Makeup Artist",
"slug": "bridal-makeup-artist",
"image": "http://wedsphotography.local/wp-content/uploads/2020/04/Rectangle-952-2.png",
"reviews": null
}
]