How to Display Different Page Content Based on the User Role

Sometimes you may want to display different content inside your account pages, depending on the user’s role.

Note: This doesn’t hide the entire page, just specific content within the page. If you want to hide entire pages based on your customer’s user role, see this doc.

To do this, take the following steps:

  1. Install and activate the User Role Editor (Pro) plugin.
    • This plugin will allow you to create different user roles in your store.
new user role
  1. Use the shortcodes that come with User Role Editor to determine which users can see the content in your account pages. User Role Editor itself has docs you can use to hide content from your users, these can be found here:
    1. In this case, we’ve used the shortcode [user_role_editor roles="wholesale"]Restricted content[/user_role_editor] The ‘Restricted content’ text within the brackets is the text we’ll be able to hide from anyone who doesn’t have the wholesale user role.
restricted content on the my account page

WooCommerce Account Pages

Add and manage pages in your WooCommerce “My Account” area using the native WordPress “Pages” functionality.

Was this helpful?

Please let us know if this article was useful. It is the best way to ensure our documentation is as helpful as possible.