Skip to content

Custom Feed for TikTok โ€‹

Custom Feed for TikTok (custom-feed-for-tiktok) is a standalone free plugin that adds TikTok feeds. It is intentionally lightweight and integrates with WP Social Ninja through the core hook seam rather than shipping its own admin or database layer.

What makes it different โ€‹

  • Independent versioning โ€” released as 1.x.x (not 4.x.x), with its own readme.txt changelog and git history.
  • No REST routes โ€” its app/Http/Routes/api.php is an empty stub. TikTok functionality is exposed through the core shortcode, the wp_ajax_wpsr_get_more_feeds handler, and the core wpsocialreviews/render_tiktok_template filter.
  • No custom tables โ€” it reads/writes core storage and caches.
  • Pro features via WP Social Ninja Pro โ€” TikTok's premium capabilities ship through Pro (which hooks the custom_feed_for_tiktok/ seam), not a separate TikTok-pro plugin.

How it boots โ€‹

Like Pro, TikTok boots off the core bootstrap action and gates on a minimum core version:

php
define('CUSTOM_FEED_FOR_TIKTOK_MIN_WPSR_VERSION', '4.5.0');

add_action('wp_social_reviews_loaded_v2', function ($app) {
    $tiktokApp = new \CustomFeedForTiktok\Application($app);
    do_action('custom_feed_for_tiktok_loaded', $tiktokApp);
});

Its Application::boot() requires app/Hooks/actions.php, filters.php, and the (empty) routes file. See Core โ†” Pro Coupling for the shared pattern.

Its extension points โ€‹

TikTok both fulfills core hooks and fires its own:

Fulfills (core namespace):

  • wpsocialreviews/render_tiktok_template โ€” returns the TikTok feed HTML for [wp_social_ninja] with platform="tiktok".
  • wpsocialreviews/get_connected_source_list โ€” supplies connected TikTok sources.

Fires (own namespace):

HookArgs
custom_feed_for_tiktok_loaded$app
wpsocialreviews/tiktok_feed_api_connect_response$response
wpsocialreviews/before_display_tiktok_feed$account_ids
custom_feed_for_tiktok/add_tiktok_feed_template$data
custom_feed_for_tiktok/tiktok_feeds_limit$limit
custom_feed_for_tiktok/tiktok_feeds_max_limit$max (Pro only, default 200)
custom_feed_for_tiktok/tiktok_video_api_details$details
custom_feed_for_tiktok/tiktok_feed_media / _author / _description / _statistics / โ€ฆtemplate element actions

What changed in 1.2.6 โ€‹

1.2.6 requires WP Social Ninja 4.5.0 or newer (CUSTOM_FEED_FOR_TIKTOK_MIN_WPSR_VERSION).

Feed limit now capped after the filter โ€” tiktok_feeds_limit ยท tiktok_feeds_max_limit

TiktokFeed::resolveFeedLimit() now applies the tier ceiling aftercustom_feed_for_tiktok/tiktok_feeds_limit. The filter can lower a feed but cannot raise it past the tier: 10 videos without Pro, 200 with Pro. Before 1.2.6 the free cap of 10 ran first, so a free site's filter could fetch more.

With Pro, the ceiling itself is filterable through the new custom_feed_for_tiktok/tiktok_feeds_max_limit. Both values are run through absint(), and the result is floored at 1.

php
add_filter('custom_feed_for_tiktok/tiktok_feeds_max_limit', function ($max) {
    return 100; // keep Pro feeds smaller; each feed is cached as one blob
});

This matches core's wpsocialreviews/facebook_feeds_limit / facebook_feeds_max_limit change in 4.5.0 (see API & Feed Tuning).

Source: app/Services/Platforms/Feeds/Tiktok/TiktokFeed.php

Editor settings response gained default_styles

The TikTok editor-settings response now includes default_styles, the output of Config::formatStylesConfig([], $postId), next to elements. The editor uses it for Reset All in the Style tab. Code that reads this response can use it as the untouched style config.

Source: app/Services/Platforms/Feeds/Tiktok/TiktokFeed.php

What changed in 1.2.5 โ€‹

Pro template routing widened โ€” custom_feed_for_tiktok/add_tiktok_feed_template

TiktokTemplateHandler previously handed off to the filter for template2 only. It now hands off for every template except template1, whenever Pro is present:

php
if (defined('WPSOCIALREVIEWS_PRO') && $templateNumber !== 'template1') {
    $html = apply_filters('custom_feed_for_tiktok/add_tiktok_feed_template', $template_body_data);
    return $html;
}

The key is read from feed_settings.template on the template meta, and reaches your callback as $template_body_data['template_meta']['template'].

Source: app/Hooks/Handlers/TiktokTemplateHandler.php (getPaginatedFeedHtml())

DANGER

A callback written against the old behaviour assumed it was only ever asked for template2. It is now also asked for template3, template4, and any future key.

Unlike core's Instagram equivalent, TikTok does not type-check the return โ€” whatever the filter hands back is returned to the caller. An unfulfilled or non-string return therefore propagates the array rather than falling back to template1. Branch on $template_body_data['template_meta']['template'] and render every key you claim.

Header layouts โ€” header_settings.header_layout

TikTok feeds now carry a header layout alongside the existing show/hide toggle. Valid values are classic (the original header) and minimal (a flat header). Anything else falls back to classic โ€” the value is validated in both Config.php and the view helper, so an invalid stored setting cannot reach the markup.

php
use CustomFeedForTiktok\Application\Services\Platforms\Feeds\Tiktok\Helper as TiktokHelper;

// 'wpsr-tiktok-feed-header-layout-classic' | 'โ€ฆ-minimal'
$class = TiktokHelper::getHeaderLayoutClass($feed_settings);

The class lands on .wpsr-tiktok-feed-header, so target a layout with .wpsr-tiktok-feed-header-layout-minimal in your own CSS.

Source: app/Services/Platforms/Feeds/Tiktok/{Config,Helper}.php, app/Views/public/feeds-templates/tiktok/header.php

New style key โ€” styles.profile_photo.color.border_color

The header styling tab gained a Profile Photo border color, conditional on header_settings.header_layout === 'minimal' and disabled without Pro. Its selector is scoped to the minimal layout, which is the only header that rings the photo:

.wpsr-tiktok-feed-template-{postId} .wpsr-tiktok-feed-header.wpsr-tiktok-feed-header-layout-minimal
  โ€ฆ .wpsr-tiktok-feed-user-profile-pic img

Source: app/Services/Platforms/Feeds/Tiktok/Config.php

Feed API โ€” video_description now requested

The user_feed field list requests video_description in addition to id, title, duration, cover_image_url, embed_link and create_time. Captions were previously absent from the response, so caption rendering and the word/hashtag filters had only the title to match against.

The list is still filterable โ€” if you replace it wholesale via custom_feed_for_tiktok/tiktok_video_api_details, add video_description to your own string or captions disappear again.

Source: app/Services/Platforms/Feeds/Tiktok/TiktokFeed.php

The service class โ€‹

TikTok mirrors the core feed structure: Services/Platforms/Feeds/Tiktok/{Config, TiktokFeed, Helper}.php, where TiktokFeed extends BaseFeed. It registers via (new TiktokFeed())->registerHooks() โ€” the same approach any feed platform uses. See Feeds Platforms.

Rendering TikTok

Because TikTok has no shortcode of its own, render a feed with the core shortcode:

[wp_social_ninja id="123" platform="tiktok"]

This fires wpsocialreviews/render_tiktok_template, which the TikTok plugin fulfills.

WP Social Ninja Developer Documentation