Appearance
Shortcodes
[wp_social_ninja]
The universal shortcode. A single shortcode renders every platform: platform selects the renderer, and the saved template's meta drives everything else. Registered in app/Hooks/Handlers/ShortcodeHandler.php → makeShortcode().
[wp_social_ninja id="123" platform="reviews"]
[wp_social_ninja id="456" platform="instagram"]
[wp_social_ninja id="789" platform="facebook_feed"]Attributes
| Attribute | Description |
|---|---|
id | Required. The template ID (a WordPress post) to render. Without it the shortcode prints nothing. |
platform | Required. The renderer: one of reviews, twitter, youtube, instagram, facebook, facebook_feed, tiktok, testimonial (see wpsocialreviews/shortcode_allowed_platforms below). Badge and notification templates are reviews templates, so they use platform="reviews". |
product_id | Optional. A WooCommerce/FluentCart product ID for product-context reviews. |
shortcode_atts() drops any other attribute, including type. Without platform the shortcode prints "Please, set a template platform name or template id on your shortcode", and with a value not in the list it prints "Provided platform name is not valid." Feed and display options come from the template meta, not from attributes.
wpsocialreviews/shortcode_allowed_platforms 4.5.0
wpsocialreviews/shortcode_allowed_platforms — Which platform values may render
When it runs: Applied by Helper::shortcodeAllowedPlatforms() (App\Services\Helper). Two callers check against it: makeShortcode(), and the public wpsr_get_more_feeds pagination AJAX handler, which answers 403 Invalid platform. for a value not in the list.
Parameters:
$platforms(string[]):reviews,twitter,youtube,instagram,facebook,tiktok,facebook_feed,testimonial.
Source: app/Services/Helper.php, app/Hooks/Handlers/ShortcodeHandler.php
Usage:
php
// Stop Twitter templates rendering anywhere on the site.
add_filter('wpsocialreviews/shortcode_allowed_platforms', function ($platforms) {
return array_values(array_diff($platforms, ['twitter']));
});Removing is safe; adding is not
Every value except tiktok is dispatched to ShortcodeHandler::render{Name}Template(). No method_exists() check runs first, so a slug core has no render method for causes a fatal error. Use this filter to narrow the list. To render a new platform, fulfill an existing seam such as wpsocialreviews/render_tiktok_template.
How rendering works
- The shortcode resolves the template post and its meta.
- It fetches the platform's data (from cache/DB) and business info.
- It fires the platform's template element action hooks and applies the
add_*_templateHTML filters to build the output. - It enqueues template assets via
wpsocialreviews/load_template_assets.
For the hooks involved, see Action Hooks → Template element rendering and Filter Hooks → Rendering / template HTML.
The public-render guard
Template configs live in post meta, so any render-by-id path would otherwise accept any post id — including draft, private, and password-protected templates, and posts belonging to other plugin post types that share the _wpsr_template_config meta key (notifications, chat widgets). The wpsr-ajax-nonce used by the public AJAX renderers is printed for logged-out visitors, so it authenticates nothing here.
Every render-by-id path therefore calls one guard first:
php
$wpsr_handler = new \WPSocialReviews\App\Hooks\Handlers\ShortcodeHandler();
if (!$wpsr_handler->isPublicRenderableTemplate($templateId)) {
return '';
}It returns true only for a published, non-password-protected post of an allowed type — otherwise it falls back to current_user_can('edit_post', $id), so admin-side previews keep working while anonymous callers do not.
Call it in your own render-by-id endpoints
If you register an AJAX or REST endpoint that renders a template from a client-supplied id, call this guard before touching the meta. The nonce alone does not gate it.
The allowed post types default to ['wp_social_reviews'] and are filterable:
php
4.4.0 The method gained an optional second parameter for callersadd_filter('wpsocialreviews/public_renderable_template_post_types', function ($types) {
$types[] = 'my_addon_template';
return $types;
});that legitimately serve an extra post type, without widening the filter globally. Every other check still applies. Core uses it for notification popups, which render a reviews feed from their own post type:
php
$wpsr_extra_post_types = $platform === 'reviews' ? ['wpsr_reviews_notify'] : [];
$wpsr_handler->isPublicRenderableTemplate($templateId, $wpsr_extra_post_types);Prefer the parameter over the filter when only one endpoint needs the extra type — the filter widens it for every caller.
Source: app/Hooks/Handlers/ShortcodeHandler.php
TikTok
The TikTok plugin registers no shortcode of its own. TikTok feeds render through [wp_social_ninja] with platform="tiktok", which fires the wpsocialreviews/render_tiktok_template filter that the TikTok plugin fulfills.
[wpsr_review_form] (Pro)
Renders a review-collection form. Registered in Pro app/Hooks/Handlers/ReviewFormHandler.php → handleShortcode().
[wpsr_review_form id="12"]| Attribute | Description |
|---|---|
id | Required. The review form ID (a row in wpsr_review_forms). |
Rendering fires the Pro review-form action hooks — review_form_before_render, review_form_after_fields — and on submit runs validation, spam protection, and captcha. See Action Hooks → Pro review-form lifecycle.
Rendering programmatically
To render a template in PHP without a shortcode, use the global helper:
php
echo do_shortcode('[wp_social_ninja id="123" platform="reviews"]');
// or resolve the raw data:
$data = wpsrGetReviewsDataFromTemplate(123); // template_meta + reviews + business_infoSee Global Helpers.

