acf/pre_load_reference filter-hookACF 5.6.5

acf_get_reference

Retrieves the field key for a given field name and post_id.

Usage

add_filter( 'acf/pre_load_reference', 'wp_kama_acf_pre_load_reference_filter', 10, 2 );

/**
 * Function for `acf/pre_load_reference` filter-hook.
 * 
 * @param string $field_name The name of the field. eg 'sub_heading'.
 * @param        $post_id    
 *
 * @return string
 */
function wp_kama_acf_pre_load_reference_filter( $field_name, $post_id ){
	// filter...
	return $field_name;
}
$field_name(string)
The name of the field. eg 'sub_heading'.
$post_id
-

Changelog

Since 5.6.5 Introduced.

Where the hook is called

acf_get_reference()
acf/pre_load_reference
acf/includes/acf-value-functions.php 29
$reference = apply_filters( 'acf/pre_load_reference', null, $field_name, $post_id );

Where the hook is used in Advanced Custom Fields PRO

acf/includes/forms/form-customizer.php 235
add_filter( 'acf/pre_load_reference', array( $this, 'pre_load_reference' ), 10, 3 );