ACF_Local_Meta::pre_load_metadatapublicACF 5.8.0

pre_load_metadata

Injects the local meta.

Method of the class: ACF_Local_Meta{}

No Hooks.

Returns

Mixed.

Usage

$ACF_Local_Meta = new ACF_Local_Meta();
$ACF_Local_Meta->pre_load_metadata( $null, $post_id, $name, $hidden );
$null(null) (required)
An empty parameter. Return a non null value to short-circuit the function.
$post_id((int|string)) (required)
The post id.
$name(string) (required)
The meta name.
$hidden(true|false) (required)
If the meta is hidden (starts with an underscore).

Changelog

Since 5.8.0 Introduced.

ACF_Local_Meta::pre_load_metadata() code ACF 6.8.8

function pre_load_metadata( $null, $post_id, $name, $hidden ) {
	$name = ( $hidden ? '_' : '' ) . $name;
	if ( isset( $this->meta[ $post_id ] ) ) {
		if ( isset( $this->meta[ $post_id ][ $name ] ) ) {
			return $this->meta[ $post_id ][ $name ];
		}
		return '__return_null';
	}
	return $null;
}