ACF_Field_User::format_user_for_jsonld
Format a single user for JSON-LD output.
Method of the class: ACF_Field_User{}
No Hooks.
Returns
array. The formatted user data.
Usage
// private - for code of main (parent) class only $result = $this->format_user_for_jsonld( $user, $output_format );
- $user(WP_User) (required)
- The user object.
- $output_format(string) (required)
- The output format (Person or Organization).
Changelog
| Since 6.8.0 | Introduced. |
ACF_Field_User::format_user_for_jsonld() ACF Field User::format user for jsonld code ACF 6.8.8
private function format_user_for_jsonld( $user, $output_format ) {
$data = array(
'@type' => $output_format,
'name' => $user->get( 'display_name' ),
);
// Add URL if available.
$url = $user->get( 'user_url' );
if ( $url ) {
$data['url'] = $url;
}
return $data;
}