Overview
↑ Back to top[wcm_directory]
shortcode that lets you publicly display members on your site within a directory. By passing certain arguments into the shortcode, you can opt to show members of only certain plans or statuses, and this shortcode can be included in a restricted page as well to keep it private for members-only, if desired.
As of Memberships 1.26.1, new installations of Memberships will need to go to WooCommerce > Settings > Memberships > Member Directory and select Enable Member Directory shortcode and block to enable the ability to display a list of members in posts and pages that include the corresponding block or shortcode. With existing installations of Memberships, this setting will be activated by default.
![Member directory block and shortcode option](https://woocommerce.com/wp-content/uploads/2024/02/memberships-member-directory-block-option.png?w=640)
This option has been added as precautionary measure. While the When implementing Member Directory shortcodes and/or blocks on Posts or Pages, keep in mind that anyone that has permissions to publish a post or page has the ability to add the shortcode or Block without the Administrator or Shop Managers consent. This could potentially allow the Member Directory to be displayed in a public facing page. The Member Directory block can be wrapped in a Restriction block for added security.
Using the directory block
↑ Back to top- In the page editor, click + to open the block library.
- Find the Member Directory block in the Membership category.
- Select the block and configure directory settings:
- Choose which membership plans and statuses to include.
- Decide how many members are shown on each page of the directory.
- Show or hide the member avatar, bio, contact information, and custom profile fields.
Using the directory shortcode
↑ Back to top[wcm_directory]
shortcode on any page or post where you want to output your listing of members. You can enter this shortcode within a Memberships block in the Gutenberg editor to easily restrict the directory within a public page, or restrict the entire page if desired.
The shortcode will show a paginated list of members on your site. By default, all active members are included.
![Example of membership directory shortcode on frontend](https://woocommerce.com/wp-content/uploads/2021/01/woocommerce-memberships-directory.png?w=541)
If you’d like to modify the directory output, you can add any of these attributes to the shortcode:
Attribute | Accepts | Output | Default |
---|---|---|---|
plans | comma-separated list of plan slugs or IDs | changes which plans are included in the directory | any |
status | comma-separated list of membership statuses | changes which status members must have to be included in the directory | any |
per_page | number | determines number of members shown per page | 12 |
bios | “yes” or “no” | determines if member biographies are shown or not | yes |
avatars | “yes” or “no” | determines if member avatars are shown or not | yes |
avatar_size | number | size of avatars to show (in pixels) | 128 |
[wcm_directory plans="silver,gold" status="active,complimentary" per_page="24" bios="no" avatars="yes" avatar_size="90"]
…to show users with active or complimentary memberships in the Silver or Gold membership plans. The directory will list 24 members per page, without biographies, and avatars at 90px each.
Questions & support
↑ Back to topAlready purchased and need some assistance or have a suggestion for how to improve the directory options? Please contact support via the help desk.