acf/fields/user/result


目录

Description

Filters the text displayed for each user.

Parameters

apply_filters( 'acf/fields/user/result', $text, $user, $field, $post_id );

Modifiers

This filter provides modifiers to target specific fields. The following filter names are available:

Example

This example demonstrates how to return user meta, in this case the user’s preferred_name_field appended to the standard result.

functions.php

<?php
add_filter('acf/fields/user/result/name=subscriber_field_name', 'my_acf_fields_user_result', 10, 4);

function my_acf_fields_user_result( $text, $user, $field, $post_id ) {

    //Retrieve the preferred name field value from user
    $recipient = get_field( 'preferred_name_field', 'user_' . $user->ID );

    $text .= ' (' . $recipient . ')';

    return $text;

}

版本号 #1
由 壳壳虫 创建于 2026-08-29 15:44:03 UTC
由 壳壳虫 更新于 2026-08-29 15:44:03 UTC