Yoast\WP\SEO\Abilities\Infrastructure
Author_Schema_User_Meta_Repository::save
Sanitizes and saves a setting of a user.
Метод класса: Author_Schema_User_Meta_Repository{}
Хуков нет.
Возвращает
bool. Whether the value was saved as provided, so false as well when it got sanitized into something else.
Использование
$Author_Schema_User_Meta_Repository = new Author_Schema_User_Meta_Repository(); $Author_Schema_User_Meta_Repository->save( $user_id, $field_name, $value ): bool;
- $user_id(int) (обязательный)
- The ID of the user.
- $field_name(строка) (обязательный)
- The name of the setting, which is its user meta key.
- $value(разное) (обязательный)
- The value to save.
Код Author_Schema_User_Meta_Repository::save() Author Schema User Meta Repository::save Yoast 28.9
public function save( int $user_id, string $field_name, $value ): bool {
$this->user_helper->update_meta( $user_id, $field_name, $this->sanitization_helper->sanitize_text_field( $value ) );
// Updating user meta also returns false when the value did not change, so the stored value is checked instead.
return $this->get( $user_id, $field_name ) === $value;
}