Contents
On this page
Hooks Reference - Plugixa Testimonial
Plugixa Testimonial exposes 9 filters and no actions, and Pro adds a tenth filter. Every one is listed on this page, and nothing is listed here that the plugin does not fire.
Note the two prefixes. They are not a typo. The frontend and integration filters are prefixed
plugixa_testimonial_, with an underscore; the ones that belong to the admin, settings and review-source layers are prefixedplugixatestimonial_, without one. The same split runs through the plugin: the REST namespace isplugixatestimonial/v1and the tables arewp_plugixatestimonial_*, while the shortcodes are[plugixa_testimonial]and[plugixa_testimonials]. Copy the name exactly as it appears below.
Filters
| Hook | Filtered value | Purpose |
|---|---|---|
plugixa_testimonial_allowed_html |
$allowed, $context |
The wp_kses() allowlist used for frontend output |
plugixa_testimonial_template_path |
$located, $template, $template_name |
The resolved template file, after the theme has been checked |
plugixa_testimonial_product_tab_title |
$title |
The WooCommerce product tab’s title |
plugixa_testimonial_product_tab_priority |
$priority |
Where the tab sits among the product’s other tabs |
plugixa_testimonial_product_tab_content |
$content, $product |
The markup rendered inside that tab |
plugixatestimonial_settings_defaults |
$defaults |
The default settings array, before stored values are merged over it |
plugixatestimonial_settings_sanitizers |
$sanitizers |
A map of settings key to sanitizer callable. A key nobody registers is not stored |
plugixatestimonial_admin_i18n_strings |
$strings |
Strings handed to the React admin |
plugixatestimonial_first_party_sources |
$sources |
The source values allowed in Review and AggregateRating JSON-LD. Add only sources that collect reviews on your own site |
plugixatestimonial_review_sources PRO |
$sources |
The registered review sources: Google, Facebook and WooCommerce |
Capabilities
Five custom capabilities gate the admin and the REST routes. They are granted to administrators on activation, and you can map them onto your own roles:
| Capability | Covers |
|---|---|
plugixa_testimonial_manage |
Reaching the admin at all |
plugixa_testimonial_edit |
Creating and editing testimonials |
plugixa_testimonial_delete |
Deleting them |
plugixa_testimonial_approve |
Moving a submission out of the pending queue |
plugixa_testimonial_settings |
The settings screens |
add_action( 'init', function () {
$role = get_role( 'editor' );
$role->add_cap( 'plugixa_testimonial_manage' );
$role->add_cap( 'plugixa_testimonial_approve' );
} );
Worked examples
Rename the WooCommerce product tab
add_filter( 'plugixa_testimonial_product_tab_title', function ( $title ) {
return 'What buyers say';
} );
add_filter( 'plugixa_testimonial_product_tab_priority', function ( $priority ) {
return 15; // earlier, right after Description
} );
Both fall back to the values on the WooCommerce settings tab, so use the filter only when you need the value computed per product.
Allow one extra tag in testimonial output
add_filter( 'plugixa_testimonial_allowed_html', function ( array $allowed, string $context ) {
$allowed['abbr'] = [ 'title' => true ];
return $allowed;
}, 10, 2 );
Point a template somewhere else
add_filter( 'plugixa_testimonial_template_path', function ( $located, $template, $template_name ) {
if ( 'grid.php' === $template_name && is_front_page() ) {
return get_stylesheet_directory() . '/testimonials-home.php';
}
return $located;
}, 10, 3 );
For the ordinary case you do not need this filter at all. Copy a template into
your-theme/plugixa-testimonial/ under the same filename and it is used instead
of the plugin’s own; the loader checks the child theme, then the parent, then
falls back to the plugin.
Add a default setting from your own code
add_filter( 'plugixatestimonial_settings_defaults', function ( array $defaults ) {
$defaults['my_extra_option'] = true;
return $defaults;
} );
add_filter( 'plugixatestimonial_settings_sanitizers', function ( array $sanitizers ) {
$sanitizers['my_extra_option'] = 'rest_sanitize_boolean';
return $sanitizers;
} );
Both are needed: the first makes the key exist, the second names the sanitizer that lets a submitted value be stored.
What is not here
There are no action hooks at all, and no filters for submission, approval, email, rendering, categories, views, shortcodes, multilingual linking or custom fields. If you need to react to a testimonial being created or approved, hook WordPress itself around the REST request, or poll the REST API; there is no plugin-side event to listen for.
Quick Links
Share