This code recipe demonstrates how to add a new [pmpro_member_search] shortcode that searches members listed in your directory. In other words, it allows users to find specific members easily. You can build a directory and frontend profiles for your members using the Member Directory and Profile Pages Add On for Paid Memberships Pro.

Once you load the recipe in your site’s customizations, you can place the shortcode in any widget area or post. To protect member search by membership level, be sure to nest the shortcode within the Require Membership shortcode or block.

Member Directory Search Add to Site

The Code Recipe

Adding the Recipe to Your Website

You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.

Modify line 15 of the recipe with the full URL of the page that holds your member directory. This is the page defined on the Memberships > Settings > Pages screen in the WordPress admin.

To use the shortcode, add the following contents to a widget or block:

[pmpro_member_search]

If you want to make this feature available to certain membership level users only, you can nest that shortcode within the Require Membership block.

Example of the Require Membership Block with Member Search Shortcode

Video Walkthrough: Coding With Sam

Free Course: Membership Site Development—The Basics

Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.

Featured Image for Membership Site Development Course: The Basics
Was this article helpful?
YesNo