diff --git a/includes/acf-field-functions.php b/includes/acf-field-functions.php index f0e48644..abddd845 100644 --- a/includes/acf-field-functions.php +++ b/includes/acf-field-functions.php @@ -20,21 +20,20 @@ function acf_get_field( $id = 0 ) { if( is_object($id) ) { $id = $id->ID; } + + // Check local fields first. + if( acf_is_local_field($id) ) { + return acf_get_local_field( $id ); + } // Check store. $store = acf_get_store( 'fields' ); if( $store->has( $id ) ) { return $store->get( $id ); } - - // Check local fields first. - if( acf_is_local_field($id) ) { - $field = acf_get_local_field( $id ); - - // Then check database. - } else { - $field = acf_get_raw_field( $id ); - } + + // Then check database. + $field = acf_get_raw_field( $id ); // Bail early if no field. if( !$field ) { diff --git a/includes/local-fields.php b/includes/local-fields.php index 26f57f29..f604c040 100644 --- a/includes/local-fields.php +++ b/includes/local-fields.php @@ -275,7 +275,25 @@ function acf_add_local_fields( $fields = array() ) { // Add each field. foreach( $fields as $field ) { + + // Validate field. + $field = acf_validate_field( $field ); + + // Set input prefix. + $field['prefix'] = 'acf'; + + /** + * Filters the $field array after it has been loaded. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array The field array. + */ + $field = apply_filters( "acf/load_field", $field ); + acf_add_local_field( $field, true ); + } }