Hooks: Actions and Filters
Extend Smart Team Pro with code. This page has ready-to-use recipes, then a reference of every action and filter the plugin provides.
Smart Team Pro has hooks: places in its code where WordPress lets your own code step in. There are two kinds:
- A filter hands you a value (a label, an icon, a piece of HTML). You change it and hand it back.
- An action lets you run your own code, or print extra output, at a set point.
To use any snippet on this page, add it to your theme's functions.php file. Use a child theme, so a theme update doesn't wipe out your changes, or a code-snippets plugin.
For developers
This page assumes you're comfortable editing PHP. A mistake in functions.php can take your site down, so test on a staging site first and keep a backup.
Blocks or classic?
Smart Team Pro renders teams in two ways, and most hooks only work in one of them:
- Block layouts (Grid, Carousel, 3D Carousel and the member field blocks) have their own small set of hooks. See Block rendering.
- Classic teams (the
[wpteam id="…"]shortcode from Manage Teams) and the plugin's built-in single member template use the older member-field hooks.
Each recipe says which one it applies to.
Classic teams cache their output
Classic teams save rendered member fields in a cache. If a snippet doesn't seem to work on a classic team, go to Smart Team Pro → Settings → Performance and click Flush Cache.
Jump to a recipe:
- Give Editors access to the plugin
- Add a company name after the job title
- Run shortcodes in the member description
- Use a custom overlay icon on member images
- Set a custom placeholder image
- Set the placeholder image size
- Use a custom email (or other contact) icon
- Change the member name heading tag
- Remove a classic team's dynamic CSS
- Show only the current language in ajax results (WPML)
- Add a class to every Grid block
- Run code when a block renders
- Turn off Ready Patterns or the AI Team Builder
- Override a classic template
Recipes
1. Give Editors access to the plugin
Applies to: the whole plugin.
By default, only Administrators can manage Smart Team Pro. To let Editors in too, return a capability Editors have (like edit_others_pages) from sp_wp_team_pro_ui_permission. The Departments, Designations and other taxonomy screens use their own filter, sp_wp_team_free_ui_permission, so set both:
function my_sptp_editor_access() {
return 'edit_others_pages';
}
add_filter( 'sp_wp_team_pro_ui_permission', 'my_sptp_editor_access' );
add_filter( 'sp_wp_team_free_ui_permission', 'my_sptp_editor_access' );2. Add a company name after the job title
Applies to: classic teams and the built-in single member template.
The sp_team_pro_after_member_job_title action runs right after each member's job title, so anything you print there appears below it:
function my_sptp_member_company_name() {
echo '<h4 class="sptp-member-company">' . esc_html__( 'Acme Inc.', 'my-theme' ) . '</h4>';
}
add_action( 'sp_team_pro_after_member_job_title', 'my_sptp_member_company_name' );Every member gets the same text. There's a matching sp_team_pro_before_… / sp_team_pro_after_… action pair for each member field. See Member field actions.
3. Run shortcodes in the member description
Applies to: classic teams.
By default, a shortcode typed into a member's description shows as plain text on classic teams. Run the description through do_shortcode() with the sptp_member_description filter:
function my_sptp_description_shortcodes( $description ) {
return do_shortcode( $description );
}
add_filter( 'sptp_member_description', 'my_sptp_description_shortcodes' );4. Use a custom overlay icon on member images
Applies to: classic teams.
When a classic team shows an icon over the member photo on hover, sptp_member_image_overlay_icon controls its markup. This swaps it for a Font Awesome 4 "play" icon:
function my_sptp_overlay_icon() {
return '<i class="fa fa-play"></i>';
}
add_filter( 'sptp_member_image_overlay_icon', 'my_sptp_overlay_icon' );5. Set a custom placeholder image
Applies to: classic teams.
Members without a photo get a grey placeholder image. To use your own, upload it to the Media Library, copy its File URL, and return that URL from sptp_member_placeholder_image_src:
function my_sptp_placeholder_image() {
return 'https://example.com/wp-content/uploads/team-placeholder.png';
}
add_filter( 'sptp_member_placeholder_image_src', 'my_sptp_placeholder_image' );Prefer an attachment ID? Return it from sptp_member_placeholder_image_id instead. The image is then treated like a real member photo and uses the team's image size settings.
6. Set the placeholder image size
Applies to: classic teams.
A placeholder from a URL (recipe 5) is shown at 600 × 450 pixels by default. Change that with sptp_placeholder_image_width and sptp_placeholder_image_height:
function my_sptp_placeholder_width() {
return 300; // In pixels.
}
add_filter( 'sptp_placeholder_image_width', 'my_sptp_placeholder_width' );
function my_sptp_placeholder_height() {
return 300; // In pixels.
}
add_filter( 'sptp_placeholder_image_height', 'my_sptp_placeholder_height' );If the team's image size is set to a custom width and height, those values win over these filters.
7. Use a custom email (or other contact) icon
Applies to: block layouts and classic teams.
Each contact detail on a member card has an icon filter named sp_team_pro_member_{field}_icon. This one replaces the email icon:
function my_sptp_email_icon() {
return '<svg viewBox="0 0 24 24" fill="currentColor" width="16" height="16" aria-hidden="true"><path d="M2 4h20v16H2z M2 4l10 8 10-8"/></svg>';
}
add_filter( 'sp_team_pro_member_email_icon', 'my_sptp_email_icon' );Swap email for phone, mobile, location, website or experience. Block layouts also support language and gender.
A few things to know:
- Use an
<i>tag or an inline<svg>. Block layouts strip any other markup (like<img>) from the icon. - Font Awesome isn't always loaded for blocks. Font Awesome 4 classes like
fa fa-envelope-openwork on classic teams. On block layouts the font may not be loaded, so an inline SVG is safer. - Classic quirk: on classic teams, the experience row also uses the email icon filter, so changing the email icon changes the experience icon too.
8. Change the member name heading tag
Applies to: classic teams and the built-in single member template.
Member names are h2 headings by default. To use a different tag, for example h1 on the single member page, filter sptp_team_pro_member_name_tag:
function my_sptp_member_name_tag() {
return 'h1';
}
add_filter( 'sptp_team_pro_member_name_tag', 'my_sptp_member_name_tag' );This changes the tag everywhere the classic name template is used. On a block-built member page, use the Member Name block's HTML Tag setting instead. See Field Blocks.
9. Remove a classic team's dynamic CSS
Applies to: classic teams.
Each classic team prints CSS built from its settings (colors, spacing, typography). If you'd rather write all the styling yourself, return an empty string from sp_team_pro_dynamic_css:
add_filter( 'sp_team_pro_dynamic_css', '__return_empty_string' );This removes the CSS that's printed next to the team. When a page has been visited before, Smart Team Pro moves that CSS into the page <head> instead, and this filter doesn't reach it there. To clear that copy too, add:
function my_sptp_remove_head_css() {
wp_styles()->add_data( 'wp-team-pro', 'after', array() );
}
add_action( 'wp_enqueue_scripts', 'my_sptp_remove_head_css', 20 );Both snippets also remove the responsive breakpoint CSS and anything in Settings → Additional CSS & JS, so the team will look unstyled until you add your own CSS.
10. Show only the current language in ajax results (WPML)
Applies to: classic teams.
When a classic team loads more members or runs a live search over ajax, Smart Team Pro skips WordPress's query filters. With WPML, that can show members from every language. If it happens on your site, let the language filter run:
add_filter( 'sptp_suppress_filters', '__return_false', 20 );The priority of 20 matters, because the plugin sets this value itself at the default priority. For the full multilingual setup, see Translations.
11. Add a class to every Grid block
Applies to: block layouts.
sptp_block_render_attributes gives you a block's settings just before it renders, so you can change them site-wide. This adds a CSS class to every Grid block:
function my_sptp_grid_class( $attributes, $block_name ) {
if ( 'grid' === $block_name ) {
$existing = isset( $attributes['additionalCssClass'] ) ? $attributes['additionalCssClass'] : '';
$attributes['additionalCssClass'] = trim( $existing . ' my-team-grid' );
}
return $attributes;
}
add_filter( 'sptp_block_render_attributes', 'my_sptp_grid_class', 10, 2 );$block_name is the block's short name without the sptp/ prefix: grid, carousel, carousel-3d, member-name and so on.
12. Run code when a block renders
Applies to: block layouts.
sptp_before_render and sptp_after_render run around every Smart Team block. They suit side jobs like loading an extra stylesheet only on pages that have a carousel:
function my_sptp_carousel_styles( $block_name ) {
if ( 'carousel' === $block_name ) {
wp_enqueue_style( 'my-team-carousel', get_stylesheet_directory_uri() . '/team-carousel.css', array(), '1.0' );
}
}
add_action( 'sptp_before_render', 'my_sptp_carousel_styles' );Don't echo from these actions. The block's HTML is returned, not printed, so anything you echo lands in the wrong place on the page.
13. Turn off Ready Patterns or the AI Team Builder
Applies to: the block editor.
To remove these features in code, for example on a client site, whatever the dashboard says:
// Turn off the Ready Patterns library (editor modal and its REST routes).
add_filter( 'sptp_ready_patterns_enabled', '__return_false' );
// Turn off the AI Team Builder.
add_filter( 'sptp_ai_builder_enabled', '__return_false' );See Patterns Library and AI Team Builder.
14. Override a classic template
Applies to: classic teams, the classic member pop-up and the built-in single member template.
Classic teams are built from small PHP template files you can override from your theme, without editing the plugin:
- Find the template in the plugin's
src/Frontend/templates/folder, for examplemember/name.php. - In your child theme, create a
wp-team-pro/templates/folder. - Copy the file in, keeping its subfolder:
your-child-theme/wp-team-pro/templates/member/name.php. - Edit your copy. Smart Team Pro uses it instead of its own.
Overridable files include the layouts (grid.php, carousel.php, list.php, table.php, accordion.php, org-chart.php …), each member field under member/ (name.php, job_title.php, email.php, social.php …), the pop-up (sptp-modal.php) and the single member page (sptp-single.php plus the layouts in member/member-templates/).
WARNING
Your copy won't receive fixes from future plugin updates. Override only the files you need, and compare them with the plugin's versions after major updates. Block layouts don't use these templates.
Hook reference
Every action and filter Smart Team Pro provides, grouped by area. Defaults are shown in the arguments column.
Block rendering
| Hook | Type | Arguments | What it does |
|---|---|---|---|
sptp_block_attributes | filter | $attributes, $block_name | Changes a block's registered attribute definitions (types and defaults) when it registers. |
sptp_block_render_attributes | filter | $attributes, $block_name | Changes a block's saved settings just before it renders. Example. |
sptp_before_render | action | $block_name, $attributes, $content, $block | Runs before any Smart Team block renders. Example. |
sptp_after_render | action | $block_name, $attributes, $output, $block | Runs after a block renders, with its HTML (read-only). |
sp_team_pro_member_{field}_icon | filter | $icon_markup, $icon_set | Icon before a contact detail on block cards. {field}: email, phone, mobile, location, website, experience, language, gender. Example. |
sptp_block_template_author | filter | $label ('Smart Team') | Author name shown for the plugin's member template in the Site Editor. |
Member details & single page
| Hook | Type | Arguments | What it does |
|---|---|---|---|
sptp_use_plugin_single_template | filter | $use_plugin, $post | Whether the plugin's own single member template renders the member page (instead of a block template). |
sptp_modal_load_by_rest_api | filter | $load | Whether classic member pop-ups load their content on demand. Overrides Settings → Performance → Load Modal by Rest API. |
the_content_sptp | filter | $content | Member description in the classic pop-up, before shortcodes run. |
sp_team_pdf_btn_label | filter | $label ('Download PDF File') | Label of the PDF download button on the built-in single member page. |
sptp_team_pro_member_name_tag | filter | $tag ('h2') | Heading tag for member names. Example. |
Member fields, classic output filters
These filters receive the finished HTML of one member field on classic teams and the built-in single page. Return changed HTML.
| Hook | What it filters |
|---|---|
sptp_member_name | Member name |
sptp_member_job_title | Job title |
sptp_member_email · sptp_member_phone · sptp_member_mobile | Email, phone and mobile rows |
sptp_member_location · sptp_member_website · sptp_member_experience | Location, website and experience rows |
sptp_member_skill | Skill bars |
sptp_member_social | Social profile icons |
sptp_member_extra_fields | Custom (extra) fields |
sptp_member_image | Member photo |
sptp_member_description | Rendered description. Example. |
sptp_member_content | Description text before it's cleaned and wrapped in paragraphs |
sptp_read_more | Read More link |
sptp_hire_button | Hire button |
sptp_author_post | Member's author posts list |
More member filters (classic):
| Hook | Arguments | What it does |
|---|---|---|
sptp_allowed_tags | $allowed_tags | HTML tags allowed in member descriptions. Add a tag here (for example iframe) to stop it being stripped. |
sptp_member_image_overlay_icon | $icon | Icon shown over member photos on hover. Example. |
sptp_member_placeholder_image_id | $attachment_id ('') | Media Library image used when a member has no photo. |
sptp_member_placeholder_image_src | $url | Placeholder image URL. Example. |
sptp_placeholder_image_width · sptp_placeholder_image_height | $px (600 / 450) | Placeholder image size. Example. |
sp_team_pro_member_{field}_icon | $icon | Contact icons on classic cards (email, phone, mobile, location, website). Example. |
Member field actions
Classic teams fire a before/after pair around each member field. Echo whatever you want to appear there.
| Action pair | Field |
|---|---|
sp_team_pro_before_member_name / sp_team_pro_after_member_name | Name |
sp_team_pro_before_member_job_title / sp_team_pro_after_member_job_title | Job title. Example. |
sp_team_pro_before_member_description / sp_team_pro_after_member_description | Description |
sp_team_pro_before_member_email / sp_team_pro_after_member_email | |
sp_team_pro_before_member_mobile / sp_team_pro_after_member_mobile | Mobile |
sp_team_pro_before_member_phone / sp_team_pro_after_member_phone | Phone |
sp_team_pro_before_member_experience / sp_team_pro_after_member_experience | Experience |
sp_team_pro_before_member_location / sp_team_pro_after_member_location | Location |
sp_team_pro_before_member_website / sp_team_pro_after_member_website | Website |
sp_team_pro_before_member_extra_fields / sp_team_pro_after_member_extra_fields | Custom fields |
sp_team_pro_before_member_skill / sp_team_pro_after_member_skill | Skills |
sp_team_pro_before_member_social / sp_team_pro_after_member_social | Social profiles |
sp_team_pro_before_section_title / sp_team_pro_after_section_title | The team's section title |
Classic team display
| Hook | Type | Arguments | What it does |
|---|---|---|---|
sptp_preloader | filter | $html | Preloader markup. |
sptp_section_title_text | filter | $title | Team section title text. |
sptp_section-title | filter | $html | Rendered section title. |
sptp_search_placeholder_text | filter | $text ('Search Member') | Placeholder in the live search box. |
sp_team_p_end_of_members_text | filter | $text | Message shown when Load More / infinite scroll runs out of members. |
sptp_custom_link_target | filter | $target ('_blank') | Link target for member custom links and single page links set to open in a new tab. |
sp_wp_team_pro_call_to_action_btn_target | filter | $target ('_blank') | Link target of the call-to-action button. |
sptp_group_filter_sort · sptp_position_filter_sort · sptp_location_filter_sort | filter | $terms, $team_id | Terms (and their order) in the live filter for Departments, Designations and Locations. |
sptp_suppress_filters | filter | $suppress | Whether member queries skip WordPress query filters. Example. |
sp_team_pro_dynamic_css | filter | $css | CSS printed next to a team. Example. |
sp_team_pro_add_custom_css | action | none | Legacy. Fires while a team's CSS is built; prefer Settings → Additional CSS & JS. |
spteam_pro_transient_expiration | filter | $seconds | How long classic teams cache member data. Overrides Settings → Performance → Cache Time. |
team_pro_style_load_in_header | filter | $bool | Deprecated, no effect. Kept so old snippets don't error. |
Patterns & AI
| Hook | Type | Arguments | What it does |
|---|---|---|---|
sptp_ready_patterns_enabled | filter | $enabled (true) | Turns the Ready Patterns library on or off. Example. |
sptp_patterns_remote_url | filter | $url | URL of the pattern list the library loads. Return '' to stop remote fetching. |
sptp_patterns_single_remote_url | filter | $url (''), $pattern_id, $manifest_url | URL for a single pattern's content. |
sptp_ai_builder_enabled | filter | $enabled (true) | Turns the AI Team Builder on or off. Example. |
sptp_ai_pattern_first_enabled | filter | $enabled (true) | Whether the AI builder may answer a prompt with a matching Ready Pattern. false always generates settings instead. |
sptp_ai_generate_rate_limit | filter | $limit (20), $user_id | AI requests each user may make per 10 minutes. 0 turns off the limit. |
Admin & permissions
| Hook | Type | Arguments | What it does |
|---|---|---|---|
sp_wp_team_pro_ui_permission | filter | $capability ('manage_options') | Capability needed to use the plugin's admin screens and dashboard. Example. |
sp_wp_team_free_ui_permission | filter | $capability ('manage_options') | Capability needed to see the taxonomy screens (Departments, Designations…). |
sptp_member_exclude_from_search | filter | $exclude | Whether members are left out of WordPress search. Overrides Settings → Advanced Controls → Exclude from Search. |
sp_team_pro_menu_position | filter | $position (80) | Position of the Smart Team Pro menu in the admin sidebar. |
sptp_dashboard_all_block_list | filter | $groups | The block list on the dashboard's Blocks page. |
sp_wp_team_pro_shortcode_imported | action | $new_team_id | Runs after each classic team is imported through Settings → Tools. |
sptp_wpml_suppress_filters | filter | $suppress (1) | Whether classic team export ignores WPML's language filter. |
sp_wp_team_home_url | filter | $url | Site URL sent when activating the license (single sites). |
wp_team_pro_is_local_server | filter | $is_local | Whether the site counts as a local server. It no longer skips the license check. |
spf_field_typography_safewebfonts | filter | $fonts | Safe web fonts in the classic Typography picker and the Single Page typography settings. |
spf_field_typography_googlestyles | filter | $styles | Font weights/styles offered for Google Fonts in the same pickers. |
spf_field_typography_customwebfonts · spf_field_typography_googlewebfonts · spf_field_typography_webfonts · spf_field_typography_defaultstyles · spf_field_typography_backup_font_family | filter | list | Font lists in the classic Typography picker. Custom fonts must already be loaded by your theme. |
Taxonomy visibility
Departments, Designations, Locations, Languages and Genders are private by default. They group members in the admin, but don't have public archive pages. Return true to make one public, then re-save Settings → Permalinks:
| Hook | Taxonomy |
|---|---|
sp_wp_team_free_group_public | Departments (sptp_group) |
sp_wp_team_free_designation_public | Designations (sptp_designation) |
sp_wp_team_free_location_public | Locations (sptp_location) |
sp_wp_team_free_language_public | Languages (sptp_language) |
sp_wp_team_free_gender_public | Genders (sptp_gender) |
add_filter( 'sp_wp_team_free_group_public', '__return_true' );The older sp_wp_team_pro_group_public filter still exists, but a later registration replaces its Department setting. Use sp_wp_team_free_group_public instead.