📖 1 minute read
If you’re using Corcel to manage WordPress content from Laravel, you might notice ACF fields breaking when you create posts programmatically. The fix: ACF stores two meta entries per field—one for the value, one for the field key.
When creating a post with ACF fields:
$article = Article::create([
'post_title' => 'Getting Started',
'post_status' => 'publish',
]);
// Save the field value
$article->saveMeta('author_name', 'John Smith');
// Also save the ACF field key reference
$article->saveMeta('_author_name', 'field_abc123def');
The _author_name meta stores the ACF field key (field_*), which ACF uses to link the value to its field configuration.
Finding your field keys: Export your ACF field group to PHP and look for the key property on each field definition.
Skip this and ACF’s UI won’t recognize your fields—they’ll appear as raw meta instead of proper ACF inputs.
Leave a Reply