acf_get_metaref()
acf_get_metaref
Retrieves reference metadata from the database.
Хуков нет.
Возвращает
Разное.
Использование
acf_get_metaref( $post_id, $type, $name );
- $post_id((int|string))
- The post id.
- $type
- .
По умолчанию:'fields' - $name(строка)
- An optional specific name.
По умолчанию:''
Список изменений
| С версии 5.2.3 | Введена. |
Код acf_get_metaref() acf get metaref ACF 6.4.2
function acf_get_metaref( $post_id = 0, $type = 'fields', $name = '' ) {
// Load existing meta.
$meta = acf_get_metadata( $post_id, "_acf_$type" );
// Handle no meta.
if ( ! $meta ) {
return $name ? '' : array();
}
// Return specific reference.
if ( $name ) {
return isset( $meta[ $name ] ) ? $meta[ $name ] : '';
// Or return all references.
} else {
return $meta;
}
}