1. Documentation /
  2. WooCommerce Memberships Directory Shortcode

WooCommerce Memberships Directory Shortcode


↑ Back to top
WooCommerce Memberships includes a [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

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
You can add a membership directory to any page on your site using the Member Directory block.
  1. In the page editor, click + to open the block library.
  2. Find the Member Directory block in the Membership category.
  3. Select the block and configure directory settings:
    1. Choose which membership plans and statuses to include.
    2. Decide how many members are shown on each page of the directory.
    3. Show or hide the member avatar, bio, contact information, and custom profile fields.
  4. Using the directory shortcode

    ↑ Back to top
    To add the directory to a page, use the [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
    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
    Putting it all together, you could use a shortcode like this…

    [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 top
    Have a question before you buy? Please fill out this pre-sales form.

    Already purchased and need some assistance or have a suggestion for how to improve the directory options? Please contact support via the help desk.