acf_get_meta()
Returns an array of "ACF only" meta for the given post_id.
Hooks from the function
Returns
array.
Usage
acf_get_meta( $post_id );
- $post_id(mixed)
- The post_id for this data.
Changelog
| Since 5.8.0 | Introduced. |
acf_get_meta() acf get meta code ACF 6.8.8
function acf_get_meta( $post_id = 0 ) {
// Allow filter to short-circuit load_value logic.
$null = apply_filters( 'acf/pre_load_meta', null, $post_id );
if ( $null !== null ) {
return ( $null === '__return_null' ) ? null : $null;
}
// Decode the $post_id for $type and $id.
$decoded = acf_decode_post_id( $post_id );
$instance = acf_get_meta_instance( $decoded['type'] );
$meta = array();
if ( $instance ) {
$meta = $instance->get_meta( $decoded['id'] );
}
/**
* Filters the $meta array after it has been loaded.
*
* @date 25/1/19
* @since 5.7.11
*
* @param array $meta The array of loaded meta.
* @param string $post_id The $post_id for this meta.
*/
return apply_filters( 'acf/load_meta', $meta, $post_id );
}