Skip Navigation

Creating a « My Account » Page in WordPress

The “My Account” page allows users to log into the site, edit their individual profiles, and more, directly from the front-end.

This page operates in two modes depending on whether a visitor is logged-in or not.

When a user is not logged in, the “My account” page appears as a login page.
When a user is not logged in, the “My account” page appears as a login page.
When logged-in, users see their account summary with links that allow them to manage their items and edit their profile
When logged-in, users see their account summary with links that allow them to manage their items and edit their profile

When a user is not logged in, the “My account” page appears as a login page. We explain the setup of this in the lesson about creating custom login forms.

When a user is logged in, the “My Account” page shows their account summary with links that allow managing their items and editing their profiles. This is what we explain on this page.

Build the “My account” page

  1. Navigate to Pages → Add new.
  2. Give your page a name (e.g., My account).
  3. Click Save Draft.
Save Draft for your page
Saving the draft for My account page

You can now design your page using the Block Editor.

In the first row of the first column, we will display the user’s login name. In the second column, we will include the logout link.

  1. Insert the Grid block with two columns.
  2. In the first column insert the Fields and Text block.
  3. Click the Add Field or View button.
Adding the field
  1. Click the User Login field.
User Login field
  1. Select The current user or the one being displayed in a View loop option.
  2. Click the Insert shortcode button.
Adding the field shortdcode

Your page should look like the following.

Displaying the user info on the frontend

The “My Account” page usually provides a set of links to other pages which users can use to view and edit resources that they own.

Here are two examples of useful links to have on a « My Account » page:

Links to other pages

The “Edit your profile” and “Add a new gym” pages you yet have to create. For now, create text placeholders which you will link a little bit later.

Adding the links to other pages

Allow users to manage their items

If your site allows users to submit their own content, it’s great to also provide them with a convenient way to manage their items from the « My Account » page.

For detailed steps, check out the lesson about allowing users to manage their items.

Hide the “My Account” page from visitors

The “My account” page lists the information for the currently logged in user. It means that the content should be hidden from other visitors.

It’s best to make the “My account” page available only for logged-in user.

You can find detailed steps for this in the lesson about restricting access to pages.

Main Toolset Block Used in this Lesson

Affichez des champs personnalisables et par défaut

Updated
mars 1, 2021