Password
The password field creates a simple password input. The password is encrypted by wp_hash_password() before saving it into the database to make sure it's safe.
Screenshots
![The password field interface](https://i.imgur.com/xozZVMx.png)
![The password field settings](/settings/password.png)
Settings
Besides the common settings, this field has the following specific settings, the keys are for use with code:
Name | Key | Description |
---|---|---|
Size of the input box | size | Size of the input box. Without this setting, the input box is full-width. |
This is a sample field settings array when creating this field with code:
[
'name' => 'Password',
'id' => 'password',
'type' => 'password',
],
Data
This field saves the encrypted password in the database for better security. The password is encrypted by wp_hash_password() function.
Template usage
As the password is encrypted in the database, you cannot get the original password via code. There's no reversing function that can turn a password hash into the original one. Otherwise, it will be insecure.
Instead of trying to get the original password, you should check the saved password is correct, like this:
<?php
$value = rwmb_meta( 'my_field_id' );
if ( wp_check_password( 'password to check', $value ) ) {
echo 'Password is correct';
}