For developers requiring advanced customization beyond the template and block settings, the Member Directory Add On offers several action and filter hooks.

Table of contents

Filters

pmpro_member_directory_display_name

Modify the display name for members in your Member Directory and Member Profile.

apply_filters( 'pmpro_member_directory_display_name', $user->display_name, $user );

Parameters

  • $user->display_name: string; The member’s display name.
  • $user: object; The member’s user object.

pmpromd_user_identifier

Filter to change how user identifiers are presented. Choose between slug and ID (case-sensitive).

apply_filters( 'pmpromd_user_identifier', 'slug' );

Parameters

  • $identifier: string; How user identifiers are presented. Accepts slug or ID. Default slug.

pmpromd_profile_url

Dynamically filter the profile URL. Use this filter to optionally link Directory entries to a specific Profile page per user ID or to an external URL.

apply_filters( 'pmpromd_profile_url', get_permalink( $pmpro_pages['profile'] ) );

Parameters

  • $profile_url: string; The profile page URL. Defaults to the permalink of the configured profile page.

pmpro_member_profile_elements

Filter the elements array for the member profile.

apply_filters( 'pmpro_member_profile_elements', $elements_array, $pu );

Parameters

  • $elements_array: array; The array of elements displayed on the member profile.
  • $pu: object; The profile user object.

Filter which links are displayed on the single Member Directory Profile page.

apply_filters( 'pmpromd_member_profile_action_links', $pmpro_member_profile_action_links );

Parameters

  • $pmpro_member_profile_action_links: array; The action links displayed on the single Member Directory Profile page.

pmpromd_get_display_value

Filter the value of a specific element from a string of HTML.

apply_filters( 'pmpromd_get_display_value', $value, $element, $pu, $displayed_levels );

Parameters

  • $value: string; The value of the element as a string of HTML.
  • $element: string; The element key being filtered.
  • $pu: object; The profile user object.
  • $displayed_levels: string; The level IDs the directory or profile is limited to, as a comma-separated list, or all.

pmpromd_allowed_html

Filter the HTML tags and attributes allowed when directory and profile values are output. The default list adds tags used by embeds (such as iframe, embed, blockquote, and script) to the tags WordPress allows in post content.

apply_filters( 'pmpromd_allowed_html', $allowed_html );

Parameters

  • $allowed_html: array; The allowed HTML tags and attributes, in the format used by wp_kses().

pmpromd_max_limit

Set the maximum number of members per page that visitors can request with the limit URL parameter on the directory (e.g., ?limit=50). If the shortcode or block limit is higher, that limit is used as the maximum instead. The shortcode’s own limit is never capped.

apply_filters( 'pmpromd_max_limit', 100, $shortcode_limit );

Parameters

  • $max_limit: int; The maximum number of members per page that can be requested in the URL. Default 100.
  • $shortcode_limit: int; The limit set in the shortcode or block, or 15 if none is set.

pmpro_member_directory_search_meta_keys

Change which user meta the directory search looks in. The display name is always searched. The user_login, user_email, and user_url fields are searched separately when they are shown in the directory.

apply_filters( 'pmpro_member_directory_search_meta_keys', $search_meta_keys, $elements_array );

Parameters

  • $search_meta_keys: array; The user meta keys to search. Defaults to first_name and last_name (searched even when not shown) plus the meta keys of the fields shown in the directory.
  • $elements_array: array; The elements shown in the directory.

pmpro_member_directory_sql_search_where

Allow filtering the member directory search SQL to be used.

apply_filters( 'pmpro_member_directory_sql_search_where', $sql_search_where, $s );

Parameters

  • $sql_search_where: string; The WHERE clause used for the directory search.
  • $s: string; The search term.

pmpro_member_directory_sql_parts

Filter the individual sections of the SQL query used to build your list of members for the directory.

apply_filters( 'pmpro_member_directory_sql_parts', $sql_parts, $levels, $s, $pn, $limit, $start, $end, $order_by, $order );

Parameters

  • $sql_parts: array; Each section of the SQL query for building your list of members. Modifiable sections: $sql_parts['SELECT'], $sql_parts['JOIN'], $sql_parts['WHERE'], $sql_parts['GROUP'], $sql_parts['ORDER'], $sql_parts['LIMIT'].
  • $levels: A single level ID or a comma-separated list of IDs (not an array of level IDs).
  • $s: string; The search term.
  • $pn: int; The current page number.
  • $limit: int; The number of results per page.
  • $start: int; The starting result offset.
  • $end: int; The ending result offset.
  • $order_by: string; The column to order results by.
  • $order: string; The sort direction.

pmpro_member_directory_sql

Allow filtering the final member directory SQL before users are queried.

apply_filters( 'pmpro_member_directory_sql', $sqlQuery, $levels, $s, $pn, $limit, $start, $end, $order_by, $order );

Parameters

  • $sqlQuery: string; The final SQL query before users are queried.
  • $levels: A single level ID or a comma-separated list of IDs (not an array of level IDs).
  • $s: string; The search term.
  • $pn: int; The current page number.
  • $limit: int; The number of results per page.
  • $start: int; The starting result offset.
  • $end: int; The ending result offset.
  • $order_by: string; The column to order results by.
  • $order: string; The sort direction.

pmpromd_user_directory_results

Filter the array of users returned from the query before display.

apply_filters( 'pmpromd_user_directory_results', $theusers );

Parameters

  • $theusers: array; The array of users returned from the query before display.

pmpro_member_directory_elements

Filter the elements array for the member directory.

apply_filters( 'pmpro_member_directory_elements', $elements_array );

Parameters

  • $elements_array: array; The array of elements displayed in the member directory.

pmpro_member_directory_before_atts

Filter the attributes of the directory shortcode or block before the directory and map are displayed.

apply_filters( 'pmpro_member_directory_before_atts', $shortcode_atts );

Parameters

  • $shortcode_atts: array; The directory attributes, including elements_array and the map attributes.

pmpro_member_profile_before_atts

Filter the attributes of the profile shortcode or block before the profile and map are displayed.

apply_filters( 'pmpro_member_profile_before_atts', $shortcode_atts );

Parameters

  • $shortcode_atts: array; The profile attributes, including the map attributes.

pmpromd_pagination_url

Filter the query arguments added to the directory’s pagination links.

apply_filters( 'pmpromd_pagination_url', array( 'ps' => $s, 'limit' => $limit ), 'prev' );

Parameters

  • $query_args: array; The query arguments for the pagination links. Defaults to the search term (ps) and the number of members per page (limit).
  • $type: string; Deprecated and no longer used. Always prev.

pmpro_member_directory_cache_enabled

Turn the directory query cache on or off. The Add On caches each directory query’s results (including searches and pagination) using the WordPress object cache.

apply_filters( 'pmpro_member_directory_cache_enabled', true );

Parameters

  • $enabled: bool; Whether to read and write the directory query cache. Default true.

pmpro_member_directory_cache_ttl

Change how long cached directory query results are kept.

apply_filters( 'pmpro_member_directory_cache_ttl', 15 * MINUTE_IN_SECONDS );

Parameters

  • $ttl: int; The cache lifetime in seconds. Default 15 minutes.

pmpro_member_directory_watched_user_meta

Set which user meta keys clear the directory query cache when they change. The cache is also cleared when a user registers, updates their profile, is deleted, or changes membership level. If your directory shows custom fields that can change outside of a profile update (for example, through an import or custom code), add their meta keys here so the directory updates right away.

apply_filters( 'pmpro_member_directory_watched_user_meta', array( 'first_name', 'last_name', 'pmpromd_hide_directory', 'pmpromd_pin_location' ) );

Parameters

  • $watched: array; The user meta keys that clear the cache when added, updated, or deleted. Defaults to first_name, last_name, pmpromd_hide_directory, and pmpromd_pin_location.

pmpromd_map_id

Filter to adjust the unique identifier for the map.

apply_filters( 'pmpromd_map_id', $map_id, $attributes );

Parameters

  • $map_id: string; The unique identifier for the map.
  • $attributes: array; The block/shortcode attributes.

pmpromd_map_failed_to_load_notice

Adjust the notice that is displayed when the map fails to load.

apply_filters( 'pmpromd_map_failed_to_load_notice', $notice, $map_id );

Parameters

  • $notice: string; The notice displayed when the map fails to load.
  • $map_id: string; The unique identifier for the map.

pmpromd_default_map_zoom_level

Filter to adjust the default zoom level of the map across all map instances. You can adjust the zoom level per-map by modifying the map_zoom shortcode attribute or block setting.

apply_filters( 'pmpromd_default_map_zoom_level', '8' );

Parameters

  • $zoom_level: string; The default map zoom level applied across all map instances. Default 8.

pmpromd_maps_query_params

Filter to add query parameters or load custom libraries via the Google Maps API request.

apply_filters( 'pmpromd_maps_query_params', $query_params );

Parameters

  • $query_params: array; The query parameters added to the Google Maps API request.

pmpromd_default_map_start

Adjust the map starting point location. This gets automatically overridden when there are markers on the map. Accepts an array of coordinates in the format array( 'lat' => -34.397, 'lng' => 150.644 ).

apply_filters( 'pmpromd_default_map_start', $default_start_location, $map_id );

Parameters

  • $default_start_location: array; The map starting coordinates, e.g. array( 'lat' => -34.397, 'lng' => 150.644 ). Overridden when markers are present.
  • $map_id: string; The unique identifier for the map.

pmpromd_override_first_marker

By default, the map centers on the first member marker. Return true to center the map on the default start location from the pmpromd_default_map_start filter instead.

apply_filters( 'pmpromd_override_first_marker', $override_first_marker_location, $map_id );

Parameters

  • $override_first_marker_location: bool; Whether to center the map on the default start location instead of the first marker. Does not override by default.
  • $map_id: string; The unique identifier for the map.

pmpromd_single_marker_content

Filter the infowindow HTML content for a single marker.

apply_filters( 'pmpromd_single_marker_content', $member_array['marker_content'], $member );

Parameters

  • $member_array['marker_content']: string; The infowindow HTML content for a single marker.
  • $member: object; The member the marker represents.

pmpromd_maps_geocoding_api_key

Filter to adjust the geocoding API key. This is useful if you want to use a different API key for geocoding or test a key.

apply_filters( 'pmpromd_maps_geocoding_api_key', $map_api_key );

Parameters

  • $map_api_key: string; The geocoding API key.

pmpromd_map_styles

Filter the map styles. Map styles are passed as a JSON string and can be generated using this form.

apply_filters( 'pmpromd_map_styles', $map_styles, $map_id );

Parameters

  • $map_styles: string; The map styles as a JSON string. Default empty.
  • $map_id: string; The unique identifier for the map.

pmpromd_map_cluster_markers

Control whether Google Maps markers are automatically grouped into clusters at lower zoom levels in the member directory map.

apply_filters( 'pmpromd_map_cluster_markers', true );

Parameters

  • $cluster_markers: bool; Whether markers are grouped into clusters at lower zoom levels. Default true.

Actions

pmpro_member_directory_before

Allows content to be inserted before the Member Directory content.

do_action( 'pmpro_member_directory_before', $sqlQuery, $shortcode_atts );

Parameters

  • $sqlQuery: string; The SQL query used to build the directory.
  • $shortcode_atts: array; The shortcode/block attributes.

pmpro_member_directory_after

Allows content to be inserted after the Member Directory content.

do_action( 'pmpro_member_directory_after', $sqlQuery, $shortcode_atts );

Parameters

  • $sqlQuery: string; The SQL query used to build the directory.
  • $shortcode_atts: array; The shortcode/block attributes.

pmpro_member_profile_before

Allows content to be inserted before the Member Profile content.

do_action( 'pmpro_member_profile_before', $pu );

Parameters

  • $pu: object; The profile user object.

pmpro_member_profile_after

Allows content to be inserted after the Member Profile content.

do_action( 'pmpro_member_profile_after', $pu );

Parameters

  • $pu: object; The profile user object.

Last updated on November 12, 2026


Was this article helpful?
YesNo