Home › Forums › Backend Issues (wp-admin) › Is it actually possible to populate custom fields via the REST API? › Reply To: Is it actually possible to populate custom fields via the REST API?
For me this was caused by an issue with the ACF screen that was used during the REST requests missing the attachment key. Filtering the screen and adding for media posts worked for me
add_filter(‘acf/location/screen’, function($screen) {
if ($screen[‘post_id’]) {
$post = get_post($screen[‘post_id’]);
if($post && $post->post_type == ‘attachment’) {
$screen[‘attachment’] = $screen[‘post_id’];
}
}
return $screen;
}, 10, 1);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.