WordPress at a glance
Главная Functions Users and Authors

Category: Users and Authors

Roles and Capabilities

add_role()

Add role, if it does not exist.

author_can()

Checks whether the author of the supplied post has a specific capability.

current_user_can()

Whether the current user has a specific capability.

get_role()

Retrieve role object.

is_super_admin()

Determine if user is a site admin.

map_meta_cap()

Map meta capabilities to primitive capabilities.

remove_role()

Remove role, if it exists.

user_can()

Whether a particular user has a specific capability.

wp_roles()

Retrieves the global WP_Roles instance and instantiates it if necessary.

Metadata (usermeta)

add_user_meta()

Adds meta data to a user.

delete_user_meta()

Remove metadata matching criteria from a user.

get_the_author_meta()

Retrieves the requested data of the author of the current post.

get_user_meta()

Retrieve user meta field for a user.

the_author_meta()

Outputs the field from the user's DB object. Defaults to current post's author.

update_user_meta()

Update user meta field based on user ID.

Other

auth_redirect()

Checks if a user is logged in, if not it redirects them to the login page.

count_many_users_posts()

Number of posts written by a list of users.

count_user_posts()

Number of posts user has written.

count_users()

Count number of users who have each of the user roles.

email_exists()

Checks whether the given email exists.

get_author_posts_url()

Retrieve the URL to the author page for the user with the ID provided.

get_current_user_id()

Get the current user's ID.

get_the_author()

Retrieve the author of the current post.

get_the_author_link()

Retrieve either author's link or author's name.

get_the_modified_author()

Retrieve the author who last edited the current post.

get_user_by()

Retrieve user info by a given field

get_userdata()

Retrieve user info by user ID.

get_users()

Retrieve list of users matching criteria.

is_admin_bar_showing()

Determine whether the admin bar should be showing.

sanitize_user()

Sanitizes a username, stripping out unsafe characters.

the_author_link()

Display either author's link or author's name.

the_author_posts()

Display the number of posts by the author of the current post.

the_author_posts_link()

Displays an HTML link to the author page of the current post's author.

the_modified_author()

Display the name of the author who last edited the current post, if the author's ID is available.

username_exists()

Checks whether the given username (login) exists.

validate_username()

Checks whether a username is valid.

wp_dropdown_roles()

Print out option html elements for role selectors.

wp_dropdown_users()

Create dropdown HTML content of users.

wp_get_current_user()

Retrieve the current user object.

wp_list_authors()

List all the authors of the site, with several options available.

wp_set_current_user()

Changes the current user by ID or name. The function does not authorize the user but changes the global variable $current_user and its associated variables.

Login/Logout

check_password_reset_key()

Retrieves a user row based on password reset key and login

get_password_reset_key()

Creates, stores, then returns a password reset key for user.

is_user_logged_in()

Checks if the current visitor is a logged in user.

wp_authenticate()

Checks the authorization data of the registered user (login and password) and authorizes it if the check was passed.

wp_check_password()

Checks the plaintext password against the encrypted Password.

wp_get_password_hint()

Gets the text suggesting how to create strong passwords.

wp_login_form()

Provides a simple login form for use anywhere within WordPress.

wp_login_url()

Retrieves the login URL.

wp_loginout()

Display the Log In/Out link.

wp_logout()

Log the current user out.

wp_logout_url()

Retrieves the logout URL.

wp_lostpassword_url()

Returns the URL that allows the user to retrieve the lost password

wp_register()

Display the Registration or Admin link.

wp_registration_url()

Returns the URL that allows the user to register on the site.

wp_set_auth_cookie()

Authorizes (Log in) a user by ID. Sets authentication cookies based on the transmitted user ID.

wp_set_password()

Updates the user's password with a new encrypted one. Updates the specified password in the database and resets the user's cache.

wp_signon()

Authenticates and logs a user in with 'remember' capability.

User insertion/removal

register_new_user()

Handles registering a new user.

wp_create_user()

A simpler way of inserting a user into the database.

wp_delete_user()

Remove user and optionally reassign posts and links to another user.

wp_insert_user()

Insert a user into the database.

wp_new_user_notification()

Email login credentials to a newly-registered user.

wp_update_user()

Update a user in the database.