Sometimes a field needs different settings in one place than another. The ACF load_field filter lets you change a field’s configuration when ACF loads it, without editing the field group.
This guide covers the filter’s argument, its name, key, and type variants, and an example that makes a field required.
Usage
<?php
add_filter( 'acf/load_field', 'my_load_field' );
function my_load_field( $field ) {
return $field;
}The callback receives one argument, the field settings array, and must return it. Change only the keys you need, such as label, required, or choices.
Target a Single Field
The same variants as load_value apply:
acf/load_field/name=book_titlematches the field by name.acf/load_field/key=field_5f2a1bmatches the field by key.acf/load_field/type=textmatches every text field.
Make a Field Required
This example marks a field named book_title as required:
<?php
add_filter( 'acf/load_field/name=book_title', 'my_require_book_title' );
function my_require_book_title( $field ) {
$field['required'] = true;
return $field;
}Common Mistakes
- Returning nothing. The callback must return the
$fieldarray, or the field breaks. - Changing the wrong context. The filter also runs in the admin, so a change can affect the field group editor. Check
is_admin()when you need a front-end-only change.
FAQs About ACF load_field
Does load_field Change the Saved Data?
No. It changes the field’s settings in memory for the current request. Saved values stay as they are.
What Is the Difference Between load_field and load_value?
load_field changes the field’s settings, such as its label or required status. load_value changes the value stored for a field.
Why Does My Callback Not Run?
Confirm the name or key in the variant matches the field exactly. Then check that the callback returns the $field array.
Conclusion
The acf/load_field filter lets you adjust field settings in one place without editing the field group. Start with a name or key variant so the change touches only the field you intend.
Related ACF guides:
Need a custom theme or ACF setup? Hire a WordPress developer, or reach out to me directly.
